Removing lines of a .csv file

Hello,
Does anyone have a one-liner to remove lines of a csv file if the value in a specific column is zero? For example, I have this file,

12345,COM,5,0,N,29.95,Y
12345,MOM,1,0,N,29.95,Y
12345,COM,4,0,N,9.99,Y
12345,MOM,0,2,N,9.99,Y
12345,REN,0,1,N,9.99,Y

and I want to remove lines where the third column is zero to yield:

12345,COM,5,0,N,29.95,Y
12345,MOM,1,0,N,29.95,Y
12345,COM,4,0,N,9.99,Y

Any thoughts? Thanks so much!

Hi

$ awk '$3!=0' FS=, file

Guru.

1 Like
awk -F, \$3 file
1 Like

Through sed..

sed '/^[^,]*,[^,]*,0/d' inputfile 
 
nawk -F"," ' $3 !~ /0/ ' test