nl
Format:
nl options file
Options:
-I | Increment each line number by n; the default is 1 |
-p | Do not reset the numbering when a new page is met |
nl is used to number a file, and is useful for printing out source code or log file listings.
$ nl myscript
will number the file myscript,and
$ nl myscript >hold_file
redirects the output of nl to the file hold_file, while
$ nl myscript |lpr
redirects the output of nl to the printer.
Get Linux and Unix Shell Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.