Delete line from file using ksh

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,

02;ABC;PQR;1;dfg
03;aaa;rrr;0;fgv
04;ABC;ggg;0fgv
09;eee;ABC;1;asd
04;lmn;stu;1;oik

Code for getting that line,

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.

nawk -F';' '$4!="1"' OFS=';' myFile > myNewFile

I already did the coding for each line read and getting the line, just want to delete it from file.

while read line
do
Val=`echo $line | cut -d ";" -f 4`
if [ "$Val" -eq 1 ]; then
// remove the line from file
fi
done < $file

@Poonamol

I don't know why you still prefer using "your code"... vgersh99's answer is much more sofisticated and the best way to do it!

Anyway, I believe this is what you are looking for:

...
if [ "$Val" -ne 1 ]; then 
echo "$line"
...

Cheers

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.

For instance because if you have a big file and you use one awk command your output result will come faster :wink:

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.

Thanks a lot in advance.