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.
假设我的输入文件是表格分隔的,我如何识别 $0 是否不包含单词“hello”?
非常感谢
你的意思是制表符分隔对吗?您可以在 awk 中执行此操作:
awk '!/hello/' file
该命令将打印所有$0不包含"hello".
$0
"hello"
PS:如果你想匹配全词 hello 但避免匹配 helloed 然后使用:
awk '!/(^|\y)hello(\y|$)/' file