我想在 Unix 中搜索确切的单词模式,
示例:Log.txt 文件包含以下文本:
aaa (only this 'aaa' pattern shhold be counted)
bbb
cccaaa ---> this should not be counted in grep output
ccc_aaa --> this should not be counted in grep output
ccc-aaa --> this should not be counted in grep output
ccc.aaa ---> this should not be counted in grep output
我正在使用以下代码-
count=$?
count=$(grep -c -w aaa $ZZZ\Log.txt)
这里的输出应该是 ==> 1 但我得到 4 作为输出,我想,有些东西丢失了所以,有人可以帮我解决这个问题吗?