linux下边的命令----grep

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u011123091/article/details/82056145

grep查找文件中的内容

命令格式:grep "要查找的内容" filename

-i 不区分大小写

-n (line number)显示行号

-c (count)显示有几条匹配的

-v (invert match) 反向匹配,查找的不是你要查找的内容

-H(Print the file name for each match.  This is the default when there is more than one file to search.)打印匹配到的文件名,默认选项,在超过一个文件中有的时候是默认选项

递归搜索某个目录以及子目录下的所有文件

命令格式:grep –r "被查找的字符串" 文件目录

实验效果:

猜你喜欢

转载自blog.csdn.net/u011123091/article/details/82056145