Trancemission
Technical User
I am trying to create a simple script in UNIX that will search a file for a specific line, go 2 lines forward and capture the next 2 lines. (the file is a whois query result. I am currently doing a few test scripts and coming accross problems using the Do/Done looping structure
My Script:
#!/usr/bin/sh
i=0
for line in `cat windsor-life.co.uk`
do
i=`expr $i + 1`
if [ $line -eq "*COMMERCE*" ] then
echo "Match! $line"
end if
done
The error is get is
syntax error at line 10: `done' unexpected
Any help gratefully recieevd
Cheers Trancemission
=============
If it's logical, it'll work!
My Script:
#!/usr/bin/sh
i=0
for line in `cat windsor-life.co.uk`
do
i=`expr $i + 1`
if [ $line -eq "*COMMERCE*" ] then
echo "Match! $line"
end if
done
The error is get is
syntax error at line 10: `done' unexpected
Any help gratefully recieevd
Cheers Trancemission
=============
If it's logical, it'll work!