在当前目录下查找查找包含“hello”的命令,列出文件名。
find . -type f -name "*.txt" | xargs grep "hello" -l
如果你想在当前目录下 查找"hello,world!"字符串,可以这样: grep -rn "hello,world!" ./ ./ : 表示路径为当前目录. -r 是递归查找 -n 是显示行号
本文介绍如何使用find和grep命令在当前目录及其子目录中搜索指定的字符串,包括精确匹配文件和显示行号的方法。
在当前目录下查找查找包含“hello”的命令,列出文件名。
find . -type f -name "*.txt" | xargs grep "hello" -l
如果你想在当前目录下 查找"hello,world!"字符串,可以这样: grep -rn "hello,world!" ./ ./ : 表示路径为当前目录. -r 是递归查找 -n 是显示行号
1827

被折叠的 条评论
为什么被折叠?