Remove lines that match string at end of column

I have this:

301205          0000030000041.49000000.00                   2011111815505     908       
301205          0000020000029.10000000.00                   2011111815505     962       
301205          0000010000027.56000000.00                   2011111815505     3083      
312291          0000020000032.30000000.00                   2012020230120     33        
312291          0000030000048.45000000.00                   2012020230120     256       
312291          -00005-000080.75-00000.00                   2012020230120     256       
805223          0000030000049.65000000.00                   20120301203       8         
805223          0000030000062.73000000.00                   20120301203       15        
805223          0000030000057.45000000.00                   20120301203       33      

I want to remove the lines that end with 30120 but only in the 3rd column (only marked red).

I tried these:

awk '$3 !~30120 ' rassales.txt > rassales2.txt 

removed any 30120 in 3rd column not just lines ending with

awk '$3 !=30120 ' rassales.txt > rassales2.txt 

only complete match (removed nothing)

Am I close?:wall:

Only a $-sign away :wink:

awk '$3 !~ /30120$/' infile
1 Like

Thanks!

How the hell do people get so good at regex? Well, how do eight year old's play guitar so well that they become famous for that matter...

---------- Post updated at 11:10 AM ---------- Previous update was at 11:00 AM ----------

Looks like it removed this too:

805223          0000030000049.65000000.00                   20120301203       8         
805223          0000030000062.73000000.00                   20120301203       15   

I want to keep those

---------- Post updated at 11:18 AM ---------- Previous update was at 11:10 AM ----------

NEVERMIND. I was checking the results incorrectly. :b: :rolleyes: