我正在尝试编写一个需要文件名的bash脚本,并返回包含一个单词的行。下面是示例文本:Bash找到确切的一个单词的行吗?
This has more than one word
There
is exactly one word in above line.
White-space
in the start of the above line doesn't matter.
Need-some-help.
输出:
There
White-space
Need-some-help.
我在找到使用组合SED和正则表达式。
注:我不能使用其他任何东西(它必须是bash脚本,没有自定义模块),所以建议不会有帮助。
为什么不能用grep删除任何行 –