【grep】linux 下日志查看的筛选技巧
查看关键字前后20个字符
grep -oP '.{0,20}deviceName.{0,20}' data.log
grep -oE '.{0,20}deviceName.{0,20}' data.log (在 macos下,不认识 -P 参数)
只显示一行日志的第 1 ~ 20 个字符
more data.log | cut -c 1-20
egrep 多个关键词
netstat -natp | egrep '8080|9090'
grep -oP '.{0,20}deviceName.{0,20}' data.log
grep -oE '.{0,20}deviceName.{0,20}' data.log (在 macos下,不认识 -P 参数)
more data.log | cut -c 1-20
netstat -natp | egrep '8080|9090'