1、查询字符串命令: cat fileName|grep ‘要查找的字符串’实例:cat catalina.out|grep ‘2018041417434200258001’
2.查询文件特定字符串前后文本信息获取异常日志的前10行和后50行,-i表示忽略大小写。grep -A 10 -B 50 -i ‘抓不到我’ catalina.out
获取异常日志的前10行和后10行grep -10 "isOrdered" error.log.2020-11-03.log |more 200