Add numbers to the beginning of every line in a file

Don’t use cat or any other tool which is not designed to do that. Use the program:

nl – number lines of files

Example:

$ nl --number-format=rz --number-width=9 foobar
$ nl -n rz -w 9 foobar # short-hand

Because nl is made for it 😉

Leave a Comment