1 查找日志
cat /etc/profile |grep HELP.md

2. 查找该关键字 的上下行数 -n
cat HELP.md |grep Guides -3

3. 查询两个关键字同时出现
cat 文件名.log | grep 关键字1 | grep 关键字2
cat HELP.md |grep The |grep how

4. 查询中所匹配模式的最后一项
cat HELP.md |grep Spring |tail -1

1 查找日志
cat /etc/profile |grep HELP.md
2. 查找该关键字 的上下行数 -n
cat HELP.md |grep Guides -3
3. 查询两个关键字同时出现
cat 文件名.log | grep 关键字1 | grep 关键字2
cat HELP.md |grep The |grep how
4. 查询中所匹配模式的最后一项
cat HELP.md |grep Spring |tail -1
本文标题:linux 文件日志查找 (cat xxx | grep xxx
本文链接:https://www.haomeiwen.com/subject/kqmjohtx.html
网友评论