gpt4 book ai didi

linux - 删除包含多个单词的行

转载 作者:太空狗 更新时间:2023-10-29 11:39:42 26 4
gpt4 key购买 nike

如果指定文件中有多个单词,我需要在 linux 中使用 bash 脚本删除一行。

例如文件:

$ cat testfile

This is a text
file

This line should be deleted
this-should-not.

最佳答案

awk 'NF<=1{print}' testfile

一个单词是一连串的非空白。

关于linux - 删除包含多个单词的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6166440/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com