The file (test.cfg) below here:
[TEST ITEMS]
Number Of Items = 2
Item 1 = /data/run-nov.csh,13
Item 2 = /data/run-dec.csh,14
I should change item 1 = /data/run-dec.csh,14 and item 2 = /data/run-jan.csh,3 on December
The test.sh below here :
#!/bin/sh
printf "Enter current month (mmm):"
read curmth
printf "Enter next month (mmm):"
read appmth
printf "Enter number of month for item1:"
read inumber1
printf "Enter number of month for item2:"
read inumber2
item1=`cat db/test.cfg | head -3 | tail -1 | cut -c 40-49`
item2= `cat db/preload1.ini | tail -1 | cut -c 40-49`
newitem1="$curmth.csh,$inumber1"
cmd17="sed -e 's/$item1/$newitem1/g' db/test.cfg > db/test.cfg.1"
eval $cmd17
mv -f db/test.cfg.1 db/test1.cfg
newitem2="$appmth.csh,$inumber2"
cmd18="sed -e 's/$item2/$newitem2/g' db/test1.cfg > db/test.cfg.2"
eval $cmd17
mv -f db/test.cfg.2 db/test.cfg
--------------------------------------------------
But I got the output (test.cfg) with input: curmth = dec, appmth = jan, inumber1 = 14 and inumber2 = 3 below :
[TEST ITEMS]
Number Of Items = 2
Item 1 = /data/run-dec.csh,14
Item 2 = /data/run-dec.csh,14
Anyone can help me ?
The expected result (test.cfg) should be like below here :
[TEST ITEMS]
Number Of Items = 2
Item 1 = /data/run-dec.csh,14
Item 2 = /data/run-jan.csh,3
Thanks
[TEST ITEMS]
Number Of Items = 2
Item 1 = /data/run-nov.csh,13
Item 2 = /data/run-dec.csh,14
I should change item 1 = /data/run-dec.csh,14 and item 2 = /data/run-jan.csh,3 on December
The test.sh below here :
#!/bin/sh
printf "Enter current month (mmm):"
read curmth
printf "Enter next month (mmm):"
read appmth
printf "Enter number of month for item1:"
read inumber1
printf "Enter number of month for item2:"
read inumber2
item1=`cat db/test.cfg | head -3 | tail -1 | cut -c 40-49`
item2= `cat db/preload1.ini | tail -1 | cut -c 40-49`
newitem1="$curmth.csh,$inumber1"
cmd17="sed -e 's/$item1/$newitem1/g' db/test.cfg > db/test.cfg.1"
eval $cmd17
mv -f db/test.cfg.1 db/test1.cfg
newitem2="$appmth.csh,$inumber2"
cmd18="sed -e 's/$item2/$newitem2/g' db/test1.cfg > db/test.cfg.2"
eval $cmd17
mv -f db/test.cfg.2 db/test.cfg
--------------------------------------------------
But I got the output (test.cfg) with input: curmth = dec, appmth = jan, inumber1 = 14 and inumber2 = 3 below :
[TEST ITEMS]
Number Of Items = 2
Item 1 = /data/run-dec.csh,14
Item 2 = /data/run-dec.csh,14
Anyone can help me ?
The expected result (test.cfg) should be like below here :
[TEST ITEMS]
Number Of Items = 2
Item 1 = /data/run-dec.csh,14
Item 2 = /data/run-jan.csh,3
Thanks