1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
$ grep keyword file └─$ grep L unicom.sh echo "Hello from LG, thanks for testing.
#从多个文件中查找关键字 $ grep keyword file1 file2 file3 └─$ grep -l for unicom.sh unicom.sh
#递归查找目标文件夹中所有目标信息的文件,并可实现精确过滤 $ grep -r for ./file ./file/unicom.sh:echo "Hello from LG, thanks for testing. $ grep -r for ./file | grep DEVICE $ grep -r for ./file | grep sh ./file/unicom.sh:echo "Hello from LG, thanks for testing.
#加入 -v 参数,反转grep匹配 $ grep -v keyword file
|