linux - grep 的模式和使用方法 - patterns
访问量: 3044
查看某个日志中的数字 dddd - dddddd ms 这样的模式。
cat cms_production_2013-02-20.log | grep 'in [0-9]\{4,6\}ms' find ' in xxxms' logs.
多模式查询
grep -e 条件1 -e 条件2 . -r (在当前目录下查询 两个条件的字符串)
反向查询 reverse grep
tail access.log -f | grep -vE "source=api|zhiguo|123.119.xx.188|ws"
包含与不包含 nodejs项目特别合适
grep xx . -r --include=*rb
grep xx . -r --exclude=*lock
grep xx . -r --exclude-dir=node_modules (注意不是 --exclude-dir=/node_modules , 没有这个斜线)