Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pr(1)

NL(1)  —  USER COMMANDS

NAME

nl − line numbering filter

SYNOPSIS

nl [ −htype ] [ −btype ] [ −ftype ] [ −vstart ] [ −iincr ] [ −p ] [ −lnum ] [ −ssep ] [ −wwidth ]

[ −nfmt ] [ −ddelim ] filename

DESCRIPTION

nl reads lines from filename (or the standard input), numbers them according to the options in effect, and sends its output to the standard output. 

nl views the text it reads in terms of logical pages.  Line numbering is normally reset at the start of each page.  A logical page is composed of header, body and footer sections.  The start of each page section is signaled by input lines containing section delimiters only:

Start of file
\:\:\:
header
\:\:
body
\:
footer

Empty sections are valid.  Different line-numbering options are available within each section.  The default scheme is no numbering for headers and footers. 

OPTIONS

−btype Specifies which logical page body lines are to be numbered.  type is one of:

a number all lines

t number lines with printable text only (the default)

n , no line numbering

prexp number only lines that contain the regular expression rexp

−htype Same as −btype except for the header.  The default type for the logical page header is n (no lines numbered). 

−ftype Same as −btype except for the footer.  The default for logical page footer is n (no lines numbered). 

−p Do not restart numbering at logical page delimiters. 

−vstart start is the initial value used to number logical page lines.  The default is 1. 

−iincr incr is the increment by which to number logical page lines.  The default is 1. 

−ssep sep is the character(s) used to separate the line number from the corresponding text line.  The default is a TAB. 

−wwidth width is the number of characters to be used for the line-number field.  The default is 6. 

−nfmt fmt is the line numbering format.  Recognized values are:

rn right justified, leading zeroes supressed (the default)

ln left justified, leading zeroes suppressed

rz right justified, leading zeroes kept

−lnum num is the number of blank lines to be considered as one.  For example, −l2 results in only the second adjacent blank being numbered (if the appropriate −ha, −ba, and/or −fa option is set).  The default is 1. 

−dxx The delimiter characters specifying the start of a logical page section may be changed from the default characters (\:) to two user-specified characters.  If only one character is entered, the second character remains the default character (:).  No space should appear between the −d and the delimiter characters.  To enter a backslash, use two backslashes. 

EXAMPLE

The command:

nl −v10 −i10 −d!+ file1

will number file1 starting at line number 10 with an increment of ten.  The logical page delimiters are !+. 

SEE ALSO

pr(1)

Sun Release 3.2  —  Last change:

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026