Hi,
I want to parse each line from input file. I need to look for the 4th field of line, If its 1 then I need to remove that line from file.
Input file contents are,
while read line
do
Val=`echo $line | cut -d ";" -f 4`
if [ "$Val" -eq 1 ]; then
// remove the line from file
fi
done < $file
For removing that line i used,
grep -v $line > $file
but after executing it, all lines from input file got deleted.
Please let me know where i am goes wrong. I want to write it in shell script (ksh).
Please help me out in this.
Thanks for reply.
I did 80% of coding in my way using ksh script, so for a single delete command, why I prefer any other way?
I do not want to print that line. I want to delete a line from file.
My input file is also a big one.
But for each line I need to do something, so i am parsing each line.
If one field (4th) is one i am putting data from that line into database table. So I want to delete it from input file. I did all code in ksh and mostly prefer to do in it. But awk is not my issue. I just want to remove line from file which fits in my code.