Printing a particular line to a file

Hi,

I have a file in which the entries are of the following type:

5649   S       1
0412   S       0
0423   S       1
0020   N       0
0020   N       0
1022   S       1
1022   S       1

I need to print the whole line which is having 0 in the third column into a different file

Thanks in advance.

awk '$3==0{print > "new_file"}' file

or even,

awk '$3==0' file > new_file

Thanks! It works:)

through sed..

sed -n 's/0$/&/p' inputfile > outfile

Simpler implementation of that approach:

sed -n '/0$/p' inputfile > outfile

Regards,
Alister

Ah!! yes i didn think of that.. Thank you.And more simpler below..:wink:

sed '/0$/!d'  inputfile > outfile

hehehe. touche. :slight_smile: