2001-05-04 17:25:23 +00:00
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Klaus Klein.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
2005-01-25 22:32:48 +00:00
|
|
|
.Dd January 26, 2005
|
2001-05-04 17:25:23 +00:00
|
|
|
.Dt NL 1
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
2001-05-16 10:18:20 +00:00
|
|
|
.Nm nl
|
2001-05-04 17:25:23 +00:00
|
|
|
.Nd line numbering filter
|
|
|
|
.Sh SYNOPSIS
|
2001-05-05 09:02:24 +00:00
|
|
|
.Nm
|
2001-05-04 17:25:23 +00:00
|
|
|
.Op Fl p
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl b Ar type
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl d Ar delim
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl f Ar type
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl h Ar type
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl i Ar incr
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl l Ar num
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl n Ar format
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl s Ar sep
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl v Ar startnum
|
|
|
|
.Ek
|
|
|
|
.Bk -words
|
|
|
|
.Op Fl w Ar width
|
|
|
|
.Ek
|
|
|
|
.Op Ar file
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility reads lines from the named
|
|
|
|
.Ar file
|
|
|
|
or the standard input if the
|
|
|
|
.Ar file
|
2007-03-25 18:37:59 +00:00
|
|
|
argument is omitted,
|
2001-05-04 17:25:23 +00:00
|
|
|
applies a configurable line numbering filter operation and writes the result
|
|
|
|
to the standard output.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility treats the text it reads in terms of logical pages.
|
|
|
|
Unless specified otherwise, line numbering is reset at the start of each
|
2004-07-02 22:22:35 +00:00
|
|
|
logical page.
|
|
|
|
A logical page consists of a header, a body and a footer
|
|
|
|
section; empty sections are valid.
|
|
|
|
Different line numbering options are
|
2001-05-04 17:25:23 +00:00
|
|
|
independently available for header, body and footer sections.
|
|
|
|
.Pp
|
|
|
|
The starts of logical page sections are signalled by input lines containing
|
|
|
|
nothing but one of the following sequences of delimiter characters:
|
2001-05-16 10:18:20 +00:00
|
|
|
.Bl -column "\e:\e:\e:" "Start of" -offset indent
|
2001-05-04 17:25:23 +00:00
|
|
|
.Em "Line Start of"
|
2001-07-09 15:46:02 +00:00
|
|
|
.It "\e:\e:\e: header"
|
|
|
|
.It "\e:\e: body"
|
|
|
|
.It "\e: footer"
|
2001-05-04 17:25:23 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
If the input does not contain any logical page section signalling directives,
|
|
|
|
the text being read is assumed to consist of a single logical page body.
|
|
|
|
.Pp
|
|
|
|
The following options are available:
|
2001-07-13 09:09:52 +00:00
|
|
|
.Bl -tag -width ".Fl v Ar startnum"
|
2001-05-04 17:25:23 +00:00
|
|
|
.It Fl b Ar type
|
|
|
|
Specify the logical page body lines to be numbered.
|
|
|
|
Recognized
|
|
|
|
.Ar type
|
|
|
|
arguments are:
|
2001-05-16 10:18:20 +00:00
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Cm a
|
2001-05-04 17:25:23 +00:00
|
|
|
Number all lines.
|
2001-05-16 10:18:20 +00:00
|
|
|
.It Cm t
|
2001-05-04 17:25:23 +00:00
|
|
|
Number only non-empty lines.
|
2001-05-16 10:18:20 +00:00
|
|
|
.It Cm n
|
2001-05-04 17:25:23 +00:00
|
|
|
No line numbering.
|
2001-05-16 10:18:20 +00:00
|
|
|
.It Cm p Ns Ar expr
|
2001-05-04 17:25:23 +00:00
|
|
|
Number only those lines that contain the basic regular expression specified
|
|
|
|
by
|
|
|
|
.Ar expr .
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The default
|
|
|
|
.Ar type
|
2001-05-16 10:18:20 +00:00
|
|
|
for logical page body lines is
|
|
|
|
.Cm t .
|
2001-05-04 17:25:23 +00:00
|
|
|
.It Fl d Ar delim
|
|
|
|
Specify the delimiter characters used to indicate the start of a logical
|
2004-07-02 22:22:35 +00:00
|
|
|
page section in the input file.
|
|
|
|
At most two characters may be specified;
|
2001-05-04 17:25:23 +00:00
|
|
|
if only one character is specified, the first character is replaced and the
|
|
|
|
second character remains unchanged.
|
|
|
|
The default
|
|
|
|
.Ar delim
|
2001-05-16 10:18:20 +00:00
|
|
|
characters are
|
|
|
|
.Dq Li \e: .
|
2001-05-04 17:25:23 +00:00
|
|
|
.It Fl f Ar type
|
|
|
|
Specify the same as
|
|
|
|
.Fl b Ar type
|
|
|
|
except for logical page footer lines.
|
|
|
|
The default
|
|
|
|
.Ar type
|
2001-05-16 10:18:20 +00:00
|
|
|
for logical page footer lines is
|
|
|
|
.Cm n .
|
2001-05-04 17:25:23 +00:00
|
|
|
.It Fl h Ar type
|
|
|
|
Specify the same as
|
|
|
|
.Fl b Ar type
|
|
|
|
except for logical page header lines.
|
|
|
|
The default
|
|
|
|
.Ar type
|
2001-05-16 10:18:20 +00:00
|
|
|
for logical page header lines is
|
|
|
|
.Cm n .
|
2001-05-04 17:25:23 +00:00
|
|
|
.It Fl i Ar incr
|
|
|
|
Specify the increment value used to number logical page lines.
|
|
|
|
The default
|
|
|
|
.Ar incr
|
|
|
|
value is 1.
|
|
|
|
.It Fl l Ar num
|
|
|
|
If numbering of all lines is specified for the current logical section
|
|
|
|
using the corresponding
|
2001-05-16 10:18:20 +00:00
|
|
|
.Fl b Cm a ,
|
|
|
|
.Fl f Cm a
|
2001-05-04 17:25:23 +00:00
|
|
|
or
|
2001-05-16 10:18:20 +00:00
|
|
|
.Fl h Cm a
|
2001-05-04 17:25:23 +00:00
|
|
|
option,
|
|
|
|
specify the number of adjacent blank lines to be considered as one.
|
|
|
|
For example,
|
|
|
|
.Fl l
|
|
|
|
2 results in only the second adjacent blank line being numbered.
|
|
|
|
The default
|
|
|
|
.Ar num
|
|
|
|
value is 1.
|
|
|
|
.It Fl n Ar format
|
|
|
|
Specify the line numbering output format.
|
|
|
|
Recognized
|
|
|
|
.Ar format
|
|
|
|
arguments are:
|
2001-05-16 10:18:20 +00:00
|
|
|
.Bl -tag -width indent -compact
|
|
|
|
.It Cm ln
|
2001-05-04 17:25:23 +00:00
|
|
|
Left justified.
|
2001-05-16 10:18:20 +00:00
|
|
|
.It Cm rn
|
2001-05-04 17:25:23 +00:00
|
|
|
Right justified, leading zeros suppressed.
|
2001-05-16 10:18:20 +00:00
|
|
|
.It Cm rz
|
2001-05-04 17:25:23 +00:00
|
|
|
Right justified, leading zeros kept.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The default
|
|
|
|
.Ar format
|
2001-05-16 10:18:20 +00:00
|
|
|
is
|
|
|
|
.Cm rn .
|
2001-05-04 17:25:23 +00:00
|
|
|
.It Fl p
|
|
|
|
Specify that line numbering should not be restarted at logical page delimiters.
|
|
|
|
.It Fl s Ar sep
|
|
|
|
Specify the characters used in separating the line number and the corresponding
|
|
|
|
text line.
|
|
|
|
The default
|
|
|
|
.Ar sep
|
|
|
|
setting is a single tab character.
|
|
|
|
.It Fl v Ar startnum
|
|
|
|
Specify the initial value used to number logical page lines; see also the
|
|
|
|
description of the
|
|
|
|
.Fl p
|
|
|
|
option.
|
|
|
|
The default
|
|
|
|
.Ar startnum
|
|
|
|
value is 1.
|
|
|
|
.It Fl w Ar width
|
|
|
|
Specify the number of characters to be occupied by the line number;
|
|
|
|
in case the
|
|
|
|
.Ar width
|
|
|
|
is insufficient to hold the line number, it will be truncated to its
|
|
|
|
.Ar width
|
|
|
|
least significant digits.
|
|
|
|
The default
|
|
|
|
.Ar width
|
|
|
|
is 6.
|
|
|
|
.El
|
2004-07-13 02:18:21 +00:00
|
|
|
.Sh ENVIRONMENT
|
|
|
|
The
|
2005-01-11 10:32:52 +00:00
|
|
|
.Ev LANG , LC_ALL , LC_CTYPE
|
2004-07-13 02:18:21 +00:00
|
|
|
and
|
|
|
|
.Ev LC_COLLATE
|
|
|
|
environment variables affect the execution of
|
|
|
|
.Nm
|
|
|
|
as described in
|
|
|
|
.Xr environ 7 .
|
2005-01-17 07:44:44 +00:00
|
|
|
.Sh EXIT STATUS
|
2001-08-15 09:09:47 +00:00
|
|
|
.Ex -std
|
2001-05-04 17:25:23 +00:00
|
|
|
.Sh SEE ALSO
|
2001-09-21 03:05:16 +00:00
|
|
|
.Xr jot 1 ,
|
2001-05-04 17:25:23 +00:00
|
|
|
.Xr pr 1
|
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility conforms to
|
2002-05-27 06:53:54 +00:00
|
|
|
.St -p1003.1-2001 .
|
2001-05-04 17:25:23 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility first appeared in
|
|
|
|
.At V.2 .
|
2005-01-25 22:32:48 +00:00
|
|
|
.Sh BUGS
|
|
|
|
Input lines are limited to
|
|
|
|
.Dv LINE_MAX
|
|
|
|
(2048) bytes in length.
|