headコマンドで指定した行数を除いて出力する方法
headコマンドで指定した行数を除いて出力するには-nオプションの後にマイナス値を指定します。
オプションの説明
-n, --lines=[-]NUM print the first NUM lines instead of the first 10; with the leading '-', print all but the last NUM lines of each file
-nオプションの後にマイナス値を指定した場合
$ cat test.txt 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 $ head -n 3 test.txt 01 02 03 $ head -n -3 test.txt 01 02 03 04 05 06 07 08 09 10 11 12
-nオプションを指定しない場合(デフォルトは10行)
$ head test.txt 01 02 03 04 05 06 07 08 09 10