简体   繁体   中英

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

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!

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

awk 'NF>=3' file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM