Linux 查找指定字符串

在单个文件中查找:

grep world filename 
grep 'world' filename 
grep "world" filename 

查找的内容,如果简单可以不用引号,其他情况可以添加单引号或双引号

如果字符串中包含空格,需要用引号:

grep 'hello world' filename

在多个文件中查找:

grep 'hello' test.txt test2.txt test3.txt
如果文件名结构类似,也可以用通配符来表示:
grep 'hello' test*.txt

更多用法参考:
https://www.howtoforge.com/tutorial/linux-grep-command/