匹配MOBILE_EXCEPTION_192.168.101.220\ 2012-11-12.log里面的字符串15779:
1、more MOBILE_EXCEPTION_192.168.101.220\ 2012-11-12.log | grep -i '15779'
2、more MOBILE_EXCEPTION_192.168.101.220\ 2012-11-12.log | grep -n '15779'
2、grep '15779' MOBILE_EXCEPTION_192.168.101.220\ 2012-11-12.log
如果有很多 输出时,您可以通过管道将其转到’less’上阅读:
3、 grep '15779' MOBILE_EXCEPTION_192.168.101.220\ 2012-11-12.log | less
4、
统计符合条件的日志行数:
[abin@abin logs]$ grep -c 'WapsActivityNotify, httpClient返回结果:{"message":"无效下载","success":false}' WAPS_ADVERTISE_127.0.0.1\ 2012-11-28.log
82