Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何编写只打印至少包含一个字段的行的 awk 命令
awk '{if (NF>0) print }'
您的命令有效,并打印带有一个或多个字段的行。但是awk默认打印,所以你可以简化它:
awk
awk 'NF > 0' file.txt