Whats wrong with my script?

I am trying to find a value within a properties file and declare it into a variable. Script below. I want the "memSize" to be the branch from the properties file. Right now it always tells me "Not found" What am I doing wrong?

#!/bin/sh
memsize ='';
memSize=`sed '/^\#/d' LoaderMemorySettings.properties | grep '$256' ` ; 
echo $memSize
 

Contents of properties file:

768= LAX
256=ORD

It's kinda weird that your properties file looks like that, I think the key and value should be reversed...but it's ok, so the expected output is "ORD", right?
Try this:

memSize=`grep '^256' aaa | cut -d= -f 2`
echo $memSize

I just set the file that way. I can change it around either way. thanks will try this.

---------- Post updated at 12:19 PM ---------- Previous update was at 10:59 AM ----------

Hmm. Its not finding it. I get this:
./read.sh: memSize: not found

ideas?

I would guess you still have a space in your declaration of memSize?

memSize =...

Variables should not have any spacing before or directly after the =

Thanks for respones. I changed it to below. I now get an output of blank line followed by "TEST". So my memSize variable apparently gets modified but never displays. Am I doing something still wrong here?

#!/bin/sh    
test="TEST";
memSize="TEST2";
memSize=`grep '^256' LoaderMemorySettings.properties | cut -d= -f 2`;
echo $memSize
echo $test

The code works for me.

One command would do, but the output should be the same:

$ sed -n "/^256/s/.*=//p" LoaderMemorySettings.properties 
ORD
$ X=$($ sed -n "/^256/s/.*=//p" LoaderMemorySettings.properties)
$ echo $X
ORD

Assuming that your "LoaderMemorySettings.properties" file has a line exactly starting with 256= ...

Sorry, "aaa" is the name of my test input file, you have to change it to your properties file:

I finally got it working. My problem? I apparently saved/or ftp'ed the .properties in a non ascii format. grrrrrrrr.
thanks for responses tho

---------- Post updated at 01:22 PM ---------- Previous update was at 12:35 PM ----------

Hi, sorry one more question.
If my properties file contained a line like
IAH,ATL,FRA,ODA = 128
And I read in this line and wanted to know if ATL=128 how would this look like? I have experimented with a couple things and keep messing it up. Oh and this line listed above can change so its not fixed with 4 values.
thanks again

The extra spaces you put everywhere in your config files make this a lot harder. It's also hard having to write this in bare-bones sh. In BASH or KSH I could split the list into an array, in sh the straightforward way is to grep it...

# Read IAH,ATL,FRA,ODA = 128 from a file
IFS="=" read VARS VALUE < file
# Delete extra spaces from $VARS
VARS=`echo "$VARS" | tr -d ' '`
# Check if ATL is in the string, making sure it's not just part of a var name
if echo "$VARS" | egrep -q "(^|,)ATL($|,)" &&
        [ "$VALUE" -eq 128 ]
then
    echo "ATL = 128"
fi