Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 0.72 KB  |  hits: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. find . -type f -name "*.php" | xargs grep "DEF_BASE_LOG_PATH"
  2.  
  3. linux下查找某目录下所有文件包含某字符串的命令:
  4. 从文件内容查找匹配指定字符串的行:
  5. $ grep "被查找的字符串" 文件名
  6. 从文件内容查找与正则表达式匹配的行:
  7. $ grep –e “正则表达式” 文件名
  8. 查找时不区分大小写:
  9. $ grep –i "被查找的字符串" 文件名
  10. 查找匹配的行数:
  11. $ grep -c "被查找的字符串" 文件名
  12. 从文件内容查找不匹配指定字符串的行:
  13. $ grep –v "被查找的字符串" 文件名
  14. 从根目录开始查找所有扩展名为.txt的文本文件,并找出包含"phpzixue.cn"的行
  15. find . -type f -name "*.txt" | xargs grep "phpzixue.cn"