查找多個XML文件中的‘Hello World’
grep -rnw '/dir/dir/dir' \
-e 'hello world' \
--include=\*.xml \
--color
查找并替換多個文件中的字符串
grep -rl 'hello world' /dir/dir/dir/ | xargs \
sed -i 's/hello/goodbye/g'
其中币叹,-r 表示遞歸帆锋,-l 表示只顯示文件名旁仿。