我需要从日志文件中检索最后 100 行日志。 我尝试了 sed 命令
sed -n -e '100,$p' logfilename
请告诉我如何更改此命令以专门检索 last 100 行。
最佳答案
您可以使用 tail命令如下:
tail -100 <log file> > newLogfile
现在最后 100 行将出现在 newLogfile
编辑:
twalberg 提到的最新版本的 tail使用命令:
tail -n 100 <log file> > newLogfile
https://stackoverflow.com/questions/36989457/