I have a probably easy problem but I am having problems finding an explanation.
My data file data.csv looks like this.
field1,field2,field3,field4
abc,def,ghi,jkl
123,456,789,012
mno,pqr,stu,vwx
I want to remove the line where the second column has a value of 456 so the output should look like this.
field1,field2,field3,field4
abc,def,ghi,jkl
mno,pqr,stu,vwx
But my program only prints the first line of output.
awk -F, 'NR>1 { if ($2=456) next } 1' data.csv
I think this should be easy to fix but I don't know what I'm doing wrong and I reviewed the suggested answers but didn't see any obvious explanation.
Any ideas? tia
Change "$2=456" to "$2==456". The "=" defines a relationship, while "==" just means equality.