文章目录
- 命令 find 和命令 grep 联合使用
- 命令 find 和 命令 convert 联合使用
- 命令 find 和命令 rm 联合使用
- 命令 find 和命令 xargs 联合使用
- 命令 sed 和目录 grep 联合使用
命令 find 和命令 grep 联合使用
[root@htlwk0001host test]# find . -name "*.txt" -exec grep "world" {} \; -print
hello shell world sddsfsdfds
fddfds worldworl world
worldeeworld
world
./text.txt
worlddsfdsfds34324
./test1/text4.txt
dsfdsaljflvoworlddslfljds324432
gkldfjgleoeworldsdlfjdlsworld
./text1.txt
命令含义:
在当前目录及其所有子目录下查找纯文本文件,并将文件中匹配到关键词“world”的文本行输出,也同时输出对应的文件名。