美文网首页
find和grep 简单使用

find和grep 简单使用

作者: 幻_空 | 来源:发表于2016-07-13 19:46 被阅读0次

文件(find)查找
find [路径] [选项]
创建5个文件


当前目录(/Users/apple/com.lq)查找 abc.txt

apple$ find ./ -name abc.txt


文件内容查找(grep)
grep -i main haison.c #忽略大小写
grep –n main haison.c #输出行号
grep -v main haison.c #反检索,只显示不匹配的行

先创建一个文件 vi hello.c

查找hello.c文件中的 main 并显示行号

查找hello.c文件中不包含 main 并显示行号


在 ls -l 命令中加入grep 反检索 不显示 hello 的项

相关文章

网友评论

      本文标题:find和grep 简单使用

      本文链接:https://www.haomeiwen.com/subject/bgfejttx.html