-
-
Save alexzhan/1196764 to your computer and use it in GitHub Desktop.
grep contents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -name "*.php" | xargs grep "DEF_BASE_LOG_PATH" | |
linux下查找某目录下所有文件包含某字符串的命令: | |
从文件内容查找匹配指定字符串的行: | |
$ grep "被查找的字符串" 文件名 | |
从文件内容查找与正则表达式匹配的行: | |
$ grep –e “正则表达式” 文件名 | |
查找时不区分大小写: | |
$ grep –i "被查找的字符串" 文件名 | |
查找匹配的行数: | |
$ grep -c "被查找的字符串" 文件名 | |
从文件内容查找不匹配指定字符串的行: | |
$ grep –v "被查找的字符串" 文件名 | |
从根目录开始查找所有扩展名为.txt的文本文件,并找出包含"phpzixue.cn"的行 | |
find . -type f -name "*.txt" | xargs grep "phpzixue.cn" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment