我想在具有特定字符串的文件中进行搜索,并仅显示与该字符串完全匹配的行,但这似乎不适用于grep -w
.
这只是一个示例,因为我将在脚本中搜索字符串,然后只想显示那些完全匹配的行,而不是“string-xxxx”或“string.io”。
有人有什么主意吗?
root@ubuntu-client:/var/lib/apt/lists# cat aa
aide is good
this is aide one
that is aide-common good
aide-good is not ok
hello aide-help
root@ubuntu-client:/var/lib/apt/lists#
oot@ubuntu-client:/var/lib/apt/lists# grep -w aide aa
aide is good
this is aide one
that is aide-common good
aide-good is not ok
hello aide-help
root@ubuntu-client
Run Code Online (Sandbox Code Playgroud)