tldr/pages/common/nl.md

24 lines
443 B
Markdown
Raw Normal View History

2016-12-01 00:54:59 +03:00
# nl
> A utility for numbering lines, either from a file, or from standard input.
- Number non-blank lines in a file:
2016-12-01 00:54:59 +03:00
2017-04-15 02:05:38 +03:00
`nl {{file}}`
2016-12-01 00:54:59 +03:00
- Read from standard output:
`cat {{file}} | nl {{options}} -`
2017-04-15 02:05:38 +03:00
- Number only the lines with printable text:
2016-12-01 00:54:59 +03:00
2017-04-15 02:05:38 +03:00
`nl -t {{file}}`
2016-12-01 00:54:59 +03:00
- Number all lines including blank lines:
`nl -b a {{file}}`
2017-04-15 02:05:38 +03:00
- Number only the body lines that match a basic regular expression (BRE) pattern:
2016-12-01 00:54:59 +03:00
2017-04-15 02:05:38 +03:00
`nl -b p'FooBar[0-9]' {{file}}`