1
0
mirror of git://git.suckless.org/sbase synced 2024-12-22 23:13:44 +00:00
sbase/nl.1
2015-02-20 14:12:48 +00:00

76 lines
1.3 KiB
Groff

.Dd February 20, 2015
.Dt NL 1
.Os sbase
.Sh NAME
.Nm nl
.Nd line numbering filter
.Sh SYNOPSIS
.Nm
.Op Fl b Ar type
.Op Fl i Ar incr
.Op Fl n Ar format
.Op Fl s Ar sep
.Op Fl v Ar startnum
.Op Fl w Ar width
.Op Ar file
.Sh DESCRIPTION
.Nm
reads lines from the named
.Ar file
and writes them to stdout with non-empty lines numbered. If no
.Ar file
is given
.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 ,
a regular expression as defined in
.Xr regex 7 .
.El
.It Fl i Ar incr
Defines the increment between numbered lines.
.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.
.It Fl s Ar sep
Defines the string used to separate line numbers and lines. By default this is
a tab.
.It Fl v Ar startnum
Start counting from
.Ar startnum
instead of the default 1.
.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.
.El
.Sh SEE ALSO
.Xr pr 1