2015-02-20 12:05:54 +00:00
|
|
|
.Dd February 20, 2015
|
2015-01-31 13:20:02 +00:00
|
|
|
.Dt NL 1
|
2015-01-31 19:37:03 +00:00
|
|
|
.Os sbase
|
2014-12-04 13:49:07 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm nl
|
|
|
|
.Nd line numbering filter
|
|
|
|
.Sh SYNOPSIS
|
2015-01-30 20:17:58 +00:00
|
|
|
.Nm
|
2014-12-04 13:49:07 +00:00
|
|
|
.Op Fl b Ar type
|
|
|
|
.Op Fl i Ar incr
|
2015-03-10 11:49:56 +00:00
|
|
|
.Op Fl l Ar num
|
2015-02-20 14:12:03 +00:00
|
|
|
.Op Fl n Ar format
|
2014-12-04 13:49:07 +00:00
|
|
|
.Op Fl s Ar sep
|
2015-02-20 12:05:54 +00:00
|
|
|
.Op Fl v Ar startnum
|
2015-02-20 12:15:43 +00:00
|
|
|
.Op Fl w Ar width
|
2014-12-04 13:49:07 +00:00
|
|
|
.Op Ar file
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
|
|
|
reads lines from the named
|
|
|
|
.Ar file
|
2015-01-31 13:43:27 +00:00
|
|
|
and writes them to stdout with non-empty lines numbered. If no
|
|
|
|
.Ar file
|
|
|
|
is given
|
2014-12-04 13:49:07 +00:00
|
|
|
.Nm
|
|
|
|
reads from stdin.
|
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl b Ar type
|
|
|
|
Defines which lines will be numbered:
|
|
|
|
.Bl -tag -width pstringXX
|
|
|
|
.It a
|
|
|
|
All lines.
|
|
|
|
.It n
|
|
|
|
No lines.
|
|
|
|
.It t
|
|
|
|
Only non-empty lines (default).
|
|
|
|
.It p Ns Ar expr
|
|
|
|
Only lines which match
|
|
|
|
.Ar expr ,
|
2011-05-29 20:30:44 +00:00
|
|
|
a regular expression as defined in
|
2015-02-01 19:52:28 +00:00
|
|
|
.Xr regex 7 .
|
2014-12-04 13:49:07 +00:00
|
|
|
.El
|
|
|
|
.It Fl i Ar incr
|
|
|
|
Defines the increment between numbered lines.
|
2015-03-10 11:49:56 +00:00
|
|
|
.It Fl l Ar num
|
|
|
|
Specify the number of adjacent blank lines to be considered as one. Default is 1.
|
2015-02-20 14:12:03 +00:00
|
|
|
.It Fl n Ar format
|
|
|
|
Specify the line number output format.
|
|
|
|
The
|
|
|
|
.Ar format
|
|
|
|
can be any of the following:
|
|
|
|
.Bl -tag -width pstringXX
|
|
|
|
.It ln
|
|
|
|
Left justified.
|
|
|
|
.It rn
|
|
|
|
Right justified.
|
|
|
|
.It rz
|
|
|
|
Right justified with leading zeroes.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The default
|
|
|
|
.Ar format
|
|
|
|
is rn.
|
2014-12-04 13:49:07 +00:00
|
|
|
.It Fl s Ar sep
|
2015-01-31 13:43:27 +00:00
|
|
|
Defines the string used to separate line numbers and lines. By default this is
|
2011-05-29 20:30:44 +00:00
|
|
|
a tab.
|
2015-02-20 12:05:54 +00:00
|
|
|
.It Fl v Ar startnum
|
|
|
|
Start counting from
|
|
|
|
.Ar startnum
|
|
|
|
instead of the default 1.
|
2015-02-20 12:15:43 +00:00
|
|
|
.It Fl w Ar width
|
|
|
|
The number of characters to be occupied by the line number
|
|
|
|
will be set to
|
|
|
|
.Ar width .
|
|
|
|
The default is 6.
|
2014-12-04 13:49:07 +00:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr pr 1
|