# find <directory> -type f -name "*.c" | xargs grep "<strings>" --color
其中:
<directory> 是要查找的目录;
-type f 只找文件;
-name "*.c" 指定查找C文件;
xargs 是将参数列表转换成小块分段传递给其他命令,以避免参数列表过长的问题;
<strings> 是要查找的字符串;
--color 使用标志高亮匹配字串.
# find <directory> -type f -name "*.c" | xargs grep "<strings>" --color
其中:
<directory> 是要查找的目录;
-type f 只找文件;
-name "*.c" 指定查找C文件;
xargs 是将参数列表转换成小块分段传递给其他命令,以避免参数列表过长的问题;
<strings> 是要查找的字符串;
--color 使用标志高亮匹配字串.