Print Text Files with Line Numbers: nl, cat, and More
The nl command is purpose-built for adding line numbers to text files: nl text-file By default, nl numbers all non-empty lines and skips blank lines. This behavior is controlled by the body section style, which defaults to t (text only). Common nl options Number all lines including blanks: nl -ba text-file Start numbering at a…
