
コマンドはhead -LINES
ファイルの最初の LINES 行を表示すると本で読みました。しかし、head
のマニュアル ページではこれが正当な引数であるとは説明されていないようです。何が足りないのか知りたいです。
tail
注:のマニュアル ページについても同様です。
答え1
これは標準的な引数ではなく、ごく初期の Unix システムからの名残です。GNU head/tail については、次のサイトで詳細情報を見つけることができますinfo head
。
For compatibility ‘head’ also supports an obsolete option syntax
‘-[NUM][bkm][cqv]’, which is recognized only if it is specified first.
NUM is a decimal number optionally followed by a size letter (‘b’, ‘k’,
‘m’) as in ‘-c’, or ‘l’ to mean count by lines, or other option letters
(‘cqv’). Scripts intended for standard hosts should use ‘-c NUM’ or ‘-n
NUM’ instead. If your script must also run on hosts that support only
the obsolete syntax, it is usually simpler to avoid ‘head’, e.g., by
using ‘sed 5q’ instead of ‘head -5’.
OpenBSD にはman head
短いメモがあります:
The historic syntax -count is supported by this implementation.