【摘】使用tail、head命令过滤行

tail  -n  10  test.log   查询日志尾部最后10行的日志;

tail -n +10 test.log    查询10行之后的所有日志;

head -n 10  test.log   查询日志文件中的头10行日志;

head -n -10  test.log   查询日志文件除了最后10行的其他所有日志;

cat -n test.log |tail -n +92|head -n 20

tail -n +92表示查询92行之后的日志

head -n 20 则表示在前面的查询结果里再查前20条记录

原文地址:https://www.cnblogs.com/lyongerr/p/5105568.html