Nl

From LQWiki
Jump to navigation Jump to search

The nl command numbers the lines in its input files.

In its simplest invocation, nl concatenates the contents of the file names given as arguments to standard output, with sequential line numbers. A file name of '-' (a single hyphen) as with most Unix commands, means to read from standard input.

A simple example:

$ cat > sample
first line
second line
^D
$ nl sample
     1 first line
     2 second line
$

This article is a stub and needs to be finished. Plunge forward and help it grow!

Provided by

Most (all?) Linux distributions incorporate this from the GNU Coreutils: and use its man page


Related Commands

These all relate to the output or processing of entire files

  • cat -- concatenate files into a single result.
  • tac -- line-reversed cat
  • rev -- character-reversed cat
  • od -- dump in octal and other character representations.
  • base32 -- Encode in printable characters.
  • base64 -- Encode in printable characters.