Linux Bash如何打印文件,并跳过前N行。

可以使用tail,看help:

Usage: tail [OPTION]... [FILE]...
  -n, --lines=K            output the last K lines, instead of the last 10;
                           or use -n +K to output lines starting with the Kth

因此,-n +K表示从第K行开始打印

假设要跳过头N-1行,打印剩余部分,直接:

tail -n +N

 

2 thoughts on “Linux Bash如何打印文件,并跳过前N行。

Leave a Reply to coder4 Cancel reply

Your email address will not be published. Required fields are marked *