nl
nl コマンドは引数で指定したファイルや標準入力の内容に行番号を追加します。
nl コマンドは GNU Coreutils に含まれています
code:txt
The nl utility reads lines from the named file or the standard input if
the file argument is ommitted, applies a configurable line numbering fil-
ter operation and writes the result to the standard output.
シェルスクリプトでファイルや標準出力の行頭に連番を付与する「nl」コマンド | ゲンゾウ用ポストイット
好きな寿司チェーン店で連番作るときにつかったtetsuya-k.icon
便利な時多そう。覚えておきたい
catコマンドにこういうオプション有ったような? 増井俊之.icon
最近のには無い?
-n, --number number all output lines
これみたいですkuuote.icon
catはファイルを連結するコマンドだったはずなのにファイルの中身を出力することに特化してしまっている
catのオプションで普通にできたんですね!!tetsuya-k.icon