Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sed/awk - How to remove lines with less than 3 columns

Tags:

bash

sed

awk

Really simple question. I simply need to remove lines from a list when there are less than 3 columns

Eg:

a b c
a b      <--- This one needs to disappear
a b c

I'm pretty sure awk NF does it, however I can't seem to get it right.

Thanks in advance!

like image 410
Numpty Avatar asked Dec 08 '22 16:12

Numpty


1 Answers

sed, grep, awk all can do this job. since you prefer awk, see if this helps?

awk 'NF>=3' file
like image 126
Kent Avatar answered Dec 11 '22 10:12

Kent