使用sed命令截取日志:
要点:知道具体时间的话,就填具体的起止时间,不知道的可以使用*模糊查询。
sed -n '/2021-01-06 14:34:26.001/,/2021-01-06 14:34:26.497/p' screenlog.0-20210106 > category.txt
配合grep命令截取日志(按行号截取):
确定起始行:
grep -a -n "^2021-01-06 14:05" screenlog.0 | head -1
确定结束行:
grep -a -n "^2020-01-06 14:15" screenlog.0 | head -1
截取日志:
sed -n '289018,295942p' node1.out > category2.out