From Wikipedia, the free encyclopedia nl (Unix)
nl (Unix)
nl is a Unix utility for numbering lines, either from a file 1 Apple
or from standard input, reproducing output on standard BANANA
output. 2 Allspice
It has a number of switches: strawberry
• a - number all lines
• t - number lines with printable text only It can be useful as an alternative to grep -n:
• n - no line numbering
• string - number only those lines containing the $ cat somefile
regular expression defined in the string supplied. aaa
The default applied switch is t. bbb
nl also supports a number of command line options. ccc
ddd
$ nl somefile | grep ccc
Example 3 ccc
$ nl tf
1 echo press cr See also
2 read cr • wc - the word count command
3 done • cat - concatenate command (-n flag is equivalent to
nl -a)
The following example numbers only the lines that begin • List of Unix programs
with a capital letter A (matching on the regular expres-
sion /^A/). filename is optional.
External links
$ nl -b p^A filename • [1] The program’s manpage
apple
Retrieved from "http://en.wikipedia.org/w/index.php?title=Nl_(Unix)&oldid=429920008"
Categories:
• Unix SUS2008 utilities
This page was last modified on 19 May 2011 at 18:22. Text is available under the Creative Commons Attribution-
ShareAlike License; additional terms may apply. See Terms of use for details. Wikipedia® is a registered trademark of
the Wikimedia Foundation, Inc., a non-profit organization.Contact us
Privacy policy About Wikipedia Disclaimers
1