在filename.txt里面我已经:
example1@domain1.org example1@domain1.org
example2@domain1.org example2@domain1.org
example3@domain1.org newexample3@domain1.org
example4@domain1.org oldexample4@domain1.org
example5@domain1.org otherexample5@domain1.org
我需要在里面搜索完全匹配,结果:
grep -wF "example1@domain1.org" filename.txt
这是对的。
我的问题是,如果我这样做,grep会向我显示正确的结果:
grep -wF "example1" filename.txt
也许是@(特殊字符)问题。
-w, --word-regexp
-F, --fixed-strings
答案 0 :(得分:1)
grep中的单词字符由字母,数字和下划线组成。所以@会结束一个字。 http://www.gnu.org/software/grep/manual/html_node/Matching-Control.html#Matching-Control