如何使用awk搜索文件中的完全匹配?
test.txt
hello10
hello100
hello1000
Run Code Online (Sandbox Code Playgroud)
我尝试了以下内容,它返回所有3行
awk '$0 ~ /^hello10/{print;}' test.txt
Run Code Online (Sandbox Code Playgroud)
grep -w hello10可以解决这个问题,但是在这个方面,grep版本非常有限,只有很少的交换机可用