nl(1) | line numbering filter |
curs_outopts, clearok, idcok, idlok, immedok, leaveok, nl, nonl, scrollok, setscrreg, wsetscrreg(3) | curses output options |
NL(1) | General Commands Manual | NL(1) |
nl
— line
numbering filter
nl |
[-p ] [-b
type] [-d
delim] [-f
type] [-h
type] [-i
incr] [-l
num] [-n
format] [-s
sep] [-v
startnum] [-w
width] [file] |
The nl
utility reads lines from the named
file, applies a configurable line numbering filter
operation, and writes the result to the standard output. If
file is a single dash (‘-’) or absent,
nl
reads from the standard input.
The nl
utility treats the text it reads in
terms of logical pages. Unless specified otherwise, line numbering is reset
at the start of each logical page. A logical page consists of a header, a
body and a footer section; empty sections are valid. Different line
numbering options are independently available for header, body and footer
sections.
The starts of logical page sections are signaled by input lines containing nothing but one of the following sequences of delimiter characters:
Line | Start of |
\:\:\: | header |
\:\: | body |
\: | footer |
If the input does not contain any logical page section signaling directives, the text being read is assumed to consist of a single logical page body.
The following options are available:
-b
typeThe default type for logical page body lines is t.
-d
delim-f
type-b
type
except for logical page footer lines. The default
type for logical page footer lines is n.-h
type-b
type
except for logical page header lines. The default
type for logical page header lines is n.-i
incr-l
num-b
a,
-f
a or -h
a option,
specify the number of adjacent blank lines to be considered as one. For
example, -l
2 results in only the second adjacent
blank line being numbered. The default num value is
1.-n
formatThe default format is rn.
-p
-s
sep-v
startnum-p
option. The default
startnum value is 1.-w
widthThe nl
utility exits 0 on success,
and >0 if an error occurs.
The nl
utility is compliant with the
X/Open System Interfaces option of the IEEE Std 1003.1-2008
(“POSIX.1”) specification.
The nl
utility first appeared in
AT&T System V Release 2 UNIX. It
was added to the OpenBSD 5.5 release.
October 28, 2016 | OpenBSD-current |