nl

Number lines from a file or from stdin. More information: https://manned.org/nl.1p.

nl path/to/file

command | nl -

nl --body-numbering a|n path/to/file

nl --body-numbering p'FooBar[0-9]' path/to/file

nl --line-increment increment path/to/file

nl --number-format rz|ln|rn

nl --number-width col_width path/to/file

nl --number-separator separator path/to/file