LoginSignup
50
45

More than 5 years have passed since last update.

ファイルのn行目以降を表示する

Last updated at Posted at 2012-05-09

-nオプションに対する値に+を使う

$ cat lines.txt
line_1
line_2
line_3
line_4
line_5
line_6
line_7
line_8
line_9
$ tail -n 3 lines.txt
line_7
line_8
line_9
$ tail -n +3 lines.txt
line_3
line_4
line_5
line_6
line_7
line_8
line_9

-nオプションを省略する使い方は現在のPOSIXバージョンではサポートされていない。_POSIX2_VERSION=199209と環境変数をセットすることで使用できる。

$ tail +3 lines.txt
tail: cannot open `+3' for reading: No such file or directory
$ _POSIX2_VERSION=199209 tail +3 lines.txt
line_3
line_4
line_5
line_6
line_7
line_8
line_9
50
45
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
50
45