Need help on getting the output

Hi,

I'm very new to unix.. so i need help on getting the following output..
I ve to take two values from a parm file.. then update one of those values by adding 1 to it.. and finally concatenate both the values to get the output..

My code is :

awk -F"=" 'NR<3 {print $2}' filename.parm | while read RUN_ID ver_num
do
echo "$RUN_ID" "$ver_num"
RUN_ID=`expr "$RUN_ID" + 1`
echo $RUN_ID
OUT_RUN_ID="$ver_num$RUN_ID"
echo $OUT_RUN_ID
done

I get RUN_ID and ver_num as 0 and 7.0 from the parm file.. I need my output to be 7.01 after final concatenation...

But i get my output as:
1
1
7.0
expr: 0402-046 A specified operator requires numeric parameters.

Kindly help me on this....

You may want to put some sample lines from filename.parm to make things clearer.

ver_num=7.0
RUN_ID=0
tgt_envrnmt_cd=EDL
WRK_FLW_CD=ETG
TGT_TBL_NM=ETG

these are the values in the parm file

Hey man,

I hope awk is not in the requirement as this is already doable without it and much simpler:

SOURCE="filename.parm"

# get value of RUN_ID
RUN_ID=`grep ^RUN_ID $SOURCE | cut -d= -f2`

# get value of ver_num
ver_num=`grep ^ver_num $SOURCE | cut -d= -f2`

RUN_ID=$((RUN_ID + 1))
echo $ver_num$RUN_ID

The awk command in your code is printing version and run_id in seperate lines. So the read command cannot get these values into two variables(it will work only if both values are in the same line). You may use the following:

awk -F"=" '/^RUN_ID/{run_id=$2} /^ver_num/{version=$2}END{print version""(run_id+1)}' filename.parm