51
45

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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
51
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
51
45

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?