1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-01 18:55:24 +02:00
tldr/pages/common/nl.md
Lena d427f333b2
pages/*: add backticks around I/O streams (#10436)
* as suggested in #10428
* standard input  => `stdin`
* standard output => `stdout`
* standard error  => `stderr`

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2023-08-09 10:59:02 +05:30

534 B

nl

A utility for numbering lines, either from a file, or from stdin. More information: https://www.gnu.org/software/coreutils/nl.

  • Number non-blank lines in a file:

nl {{path/to/file}}

  • Read from stdout:

cat {{path/to/file}} | nl {{options}} -

  • Number only the lines with printable text:

nl -t {{path/to/file}}

  • Number all lines including blank lines:

nl -b a {{path/to/file}}

  • Number only the body lines that match a basic regular expression (BRE) pattern:

nl -b p'FooBar[0-9]' {{path/to/file}}