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オプションを指定した場合
$ head -n 5 test.txt 01 02 03 04 05 $ head -n 12 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