简体   繁体   中英

writing an awk command to print every line that has at least one field

如何编写仅打印至少一个字段的行的awk命令

awk '{if (NF>0) print }'

You command works, and prints lines with one or more fields. But awk prints by default, so you can simplify it:

awk 'NF > 0' file.txt

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