Hi,
Following is my code :
i=3
j=3
while [ $i -le $count1 ]
do
i=`expr $i + 3`
head -n 60 file1.imp >> s27.txt
while [ $j -le 60 ]
do
head -n 3 file2.imp >> s27.imp
./prog1 s27.txt > result.txt
if grep OUT result.txt
then
head -n 3 file1.imp >> final.imp
num=`expr $num + 1`
else
k=`expr $j -3`
sed "$j,$k d" file1.imp > f1.imp
mv f1.imp file1.imp
fi
sed '1,3d' file2.imp > f2.imp
mv f2.imp file2.imp
j=`expr $j +3`
done
I am checking 3 lines from file2 at a time.
I am getting the following error in while loop and sed command. I am trying to delete 3 lines from the file1.
Error: expr: syntax error
sed: 1: "3, d": expected context address
expr: syntax error
line 21: [: -le: unary operator expected
Can I use a while loop inside a while loop. Is there something wrong in my syntax for sed and while.
Please help.
Thanks