2020-05-15 05:27:12 -04:00
|
|
|
.Dd 2020-05-15
|
2015-01-31 08:20:02 -05:00
|
|
|
.Dt NL 1
|
2015-01-31 14:37:03 -05:00
|
|
|
.Os sbase
|
2014-12-04 08:49:07 -05:00
|
|
|
.Sh NAME
|
|
|
|
.Nm nl
|
|
|
|
.Nd line numbering filter
|
|
|
|
.Sh SYNOPSIS
|
2015-01-30 15:17:58 -05:00
|
|
|
.Nm
|
2015-03-18 12:58:09 -04:00
|
|
|
.Op Fl p
|
2014-12-04 08:49:07 -05:00
|
|
|
.Op Fl b Ar type
|
2015-03-18 12:58:09 -04:00
|
|
|
.Op Fl d Ar delim
|
|
|
|
.Op Fl f Ar type
|
|
|
|
.Op Fl h Ar type
|
2015-03-22 11:29:50 -04:00
|
|
|
.Op Fl i Ar num
|
2015-03-10 07:49:56 -04:00
|
|
|
.Op Fl l Ar num
|
2015-02-20 09:12:03 -05:00
|
|
|
.Op Fl n Ar format
|
2014-12-04 08:49:07 -05:00
|
|
|
.Op Fl s Ar sep
|
2015-03-22 11:29:50 -04:00
|
|
|
.Op Fl v Ar num
|
|
|
|
.Op Fl w Ar num
|
2014-12-04 08:49:07 -05:00
|
|
|
.Op Ar file
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
2015-03-22 11:29:50 -04:00
|
|
|
reads lines from
|
2014-12-04 08:49:07 -05:00
|
|
|
.Ar file
|
2015-03-22 11:29:50 -04:00
|
|
|
and writes them to stdout, numbering non-empty lines.
|
|
|
|
If no
|
2015-01-31 08:43:27 -05:00
|
|
|
.Ar file
|
|
|
|
is given
|
2014-12-04 08:49:07 -05:00
|
|
|
.Nm
|
|
|
|
reads from stdin.
|
2020-05-15 05:27:12 -04:00
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
treats the input text as a collection of logical pages divided into
|
|
|
|
logical page sections.
|
|
|
|
Each logical page consists of a header section, a body
|
|
|
|
section and a footer section.
|
|
|
|
Sections may be empty.
|
|
|
|
The start of each section is indicated by a single delimiting line, one of:
|
|
|
|
.Bl -column "\e:\e:\e: " "header " -offset indent
|
|
|
|
.It Em "Line" Ta Em "Start of"
|
|
|
|
.It \e:\e:\e: header
|
|
|
|
.It \e:\e: body
|
|
|
|
.It \e: footer
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
If the input text contains no delimiting line then all of the input text
|
|
|
|
belongs to a single logical page body section.
|
2014-12-04 08:49:07 -05:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
2015-03-18 12:58:09 -04:00
|
|
|
.It Fl p
|
2015-03-22 11:29:50 -04:00
|
|
|
Do not reset line number for logical pages.
|
|
|
|
.It Fl h Ar type | Fl b Ar type | Fl f Ar type
|
|
|
|
Define which lines to number in the head | body | footer section:
|
2014-12-04 08:49:07 -05:00
|
|
|
.Bl -tag -width pstringXX
|
|
|
|
.It a
|
|
|
|
All lines.
|
|
|
|
.It n
|
|
|
|
No lines.
|
|
|
|
.It t
|
2020-03-01 17:37:31 -05:00
|
|
|
Only non-empty lines.
|
|
|
|
This is the default.
|
2014-12-04 08:49:07 -05:00
|
|
|
.It p Ns Ar expr
|
2015-03-22 11:29:50 -04:00
|
|
|
Only lines matching
|
|
|
|
.Ar expr
|
|
|
|
according to
|
2015-02-01 14:52:28 -05:00
|
|
|
.Xr regex 7 .
|
2014-12-04 08:49:07 -05:00
|
|
|
.El
|
2015-03-18 12:58:09 -04:00
|
|
|
.It Fl d Ar delim
|
2015-03-22 11:29:50 -04:00
|
|
|
Set
|
|
|
|
.Ar delim
|
2020-03-01 17:37:31 -05:00
|
|
|
as the delimiter for logical pages.
|
|
|
|
If
|
2015-03-22 11:29:50 -04:00
|
|
|
.Ar delim
|
2015-03-22 12:25:11 -04:00
|
|
|
is only one character,
|
2015-03-22 11:29:50 -04:00
|
|
|
.Nm
|
2020-03-01 17:37:31 -05:00
|
|
|
appends ":" to it.
|
|
|
|
The default is "\e:".
|
2015-03-22 11:29:50 -04:00
|
|
|
.It Fl i Ar num
|
|
|
|
Set the increment between numbered lines to
|
|
|
|
.Ar num .
|
2015-03-10 07:49:56 -04:00
|
|
|
.It Fl l Ar num
|
2015-03-22 11:29:50 -04:00
|
|
|
Set the number of adjacent blank lines to be considered as one to
|
|
|
|
.Ar num .
|
|
|
|
The default is 1.
|
2015-02-20 09:12:03 -05:00
|
|
|
.It Fl n Ar format
|
2015-03-22 11:29:50 -04:00
|
|
|
Set the line number output
|
2015-02-20 09:12:03 -05:00
|
|
|
.Ar format
|
2015-03-22 11:29:50 -04:00
|
|
|
to one of:
|
2015-02-20 09:12:03 -05:00
|
|
|
.Bl -tag -width pstringXX
|
|
|
|
.It ln
|
|
|
|
Left justified.
|
|
|
|
.It rn
|
2020-03-01 17:37:31 -05:00
|
|
|
Right justified.
|
|
|
|
This is the default.
|
2015-02-20 09:12:03 -05:00
|
|
|
.It rz
|
|
|
|
Right justified with leading zeroes.
|
|
|
|
.El
|
2014-12-04 08:49:07 -05:00
|
|
|
.It Fl s Ar sep
|
2015-03-22 11:29:50 -04:00
|
|
|
Use
|
|
|
|
.Ar sep
|
2020-03-01 17:37:31 -05:00
|
|
|
to separate line numbers and lines.
|
|
|
|
The default is "\et".
|
2015-03-22 11:29:50 -04:00
|
|
|
.It Fl v Ar num
|
|
|
|
Start counting lines from
|
|
|
|
.Ar num .
|
|
|
|
The default is 1.
|
|
|
|
.It Fl w Ar num
|
|
|
|
Set the width of the line number to
|
|
|
|
.Ar num .
|
2015-02-20 07:15:43 -05:00
|
|
|
The default is 6.
|
2014-12-04 08:49:07 -05:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr pr 1
|
2015-03-18 12:58:09 -04:00
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is compliant with the
|
2015-03-27 12:22:48 -04:00
|
|
|
.St -p1003.1-2013
|
2015-03-18 12:58:09 -04:00
|
|
|
specification.
|