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.
我有一个包含句子行的文件。我想打印所有超过 3 个单词的行。单词由空格分隔。
我怎么能这样做awk呢?
awk
像这样使用 awk:
awk 'NF>3' file
sed -E '/\s*(\S+\s+){3}\S+/!d' file
变量 NF 表示当前输入行的字段数。