Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ nl(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pr

nl

PURPOSE

     Numbers lines in a file.

SYNOPSIS
     nl [ -htype ] [ -btype ] [ -ftype ] [ -vstart# ] [ -iincr ] [ -p ]
     [ -l num ] [ -s sep ] [ -w width ] [ -n format ] [ -d delim ] file


DESCRIPTION

     The nl  command reads files (standard  input by default),
     numbers the lines  in the input, and  writes the numbered
     lines to standard output.  In  the output, nl numbers the
     lines on the  left according to the flags  you specify on
     the command line.

     The input  test must be  written in logical  pages.  Each
     logical page has  a header, a body, and  a footer section
     (you can  have empty  sections).  Unless  you use  the -p
     flag, nl  resets the  line numbers at  the start  of each
     logical page.  You can set line numbering flags independ-
     ently  for the  header,  body, and  footer sections  (for
     example, no  numbering of  header and footer  lines while
     numbering text lines only in the body).

     Signal the start  of logical page sections  with lines in
     file  that contain  nothing but  the following  delimiter
     characters:

     Line contents    Start of
     \:\:\:          Header
     \:\:            Body
     \:              Footer

     You can name only one file  on the command line.  You can
     list the flags and the file name in any order.

FLAGS

     All the parameters are set by default.  Use the following
     flags to  change these default settings.   Except for the
     -s  flag, enter  a flag  without a  parameter to  see its
     default value.

     -btype    Chooses  which body  section  lines to  number.
               The recognized types are:
               a         Numbers all lines.
               t         Does    not   number    blank   lines
                         (default).
               n         Does not number any lines.
               ppattern  Numbers  only those  lines containing
                         the specified pattern.
     -dxx      Uses xx  as the delimiters  for the start  of a
               logical page  section.  The  default characters
               are \:  (backslash followed  by a  colon).  You
               may specify two  ASCII characters, two one-byte
               extended characters,  or one  extended extended
               character.   If  you  enter only  one  one-byte
               character  after   -d,  the   second  character
               remains the  default (colon).   If you  want to
               use a backslash as a delimiter, enter two back-
               slashes (\\).
     -ftype    Chooses  which  logical  page footer  lines  to
               number.  The  types recognized are the  same as
               in  -btype.  The  default type  is n  (no lines
               numbered).
     -htype    Chooses  which  logical  page header  lines  to
               number.  The  types recognized are the  same as
               in  -btype.  The  default type  is n  (no lines
               numbered).
     -inum     Increments  logical page  line numbers  by num.
               The default value of num is 1.
     -lnum     Uses num as the number  of blank lines to count
               as one.  For example,  -l3 will only number the
               third adjacent blank.  The default value of num
               is 2.  This flag can  only be used in documents
               where the -ba flag is used.
     -nformat  Uses  format  as  the  line  numbering  format.
               Recognized formats are:
               ln  Left justified, leading zeroes suppressed.
               rn  Right justified,  leading zeroes suppressed
                   (default).
               rz  Right justified, leading zeroes kept.
     -p        Does  not  restart  numbering at  logical  page
               delimiters.

     -s[sep]   Separates the text from  its line number by the
               sep character.   The default value of  sep is a
               tab  character.   If  you enter  -s  without  a
               parameter, there  is no separation  between the
               line number and its text.
     -vnum     Sets the  initial logical  page line  number to
               num, (1 by default).
     -wnum     Uses  num as  the number  of characters  in the
               line number.  The default value of num is 6.

EXAMPLES

     1.  To number only the nonblank lines:

           nl  chap1

         This  displays a  numbered listing  of "chap1",  num-
         bering only the nonblank  lines in the body sections.
         If "chap1" contains no \:\:\+ :, \:\+ :, or \: delim-
         iters, then the entire file is considered the body.
     2.  To number all lines:

           nl  -ba  chap1

         This  numbers all  the  lines in  the body  sections,
         including blank  lines.  This form of  the nl command
         is adequate for most uses.
     3.  To specify a different line number format:

           nl  -i10  -nrz  -s::  -v10  -w4  chap1

         This numbers  the lines of "chap1"  starting with ten
         ("-v10") and counting by  tens ("-i10").  It displays
         four  digits  for   each  number  ("-w4"),  including
         leading zeroes ("-nrz").  The  line numbers are sepa-
         rated from the text by two colons ("-s::").

         For example, if "chap1" contains the text:

           A not-so-important
           note to remember:
           You can't kill time
           without injuring eternity.

         then the numbered listing is:

           0010::A not-so-important
           0020::note to remember:
           0030::You can't kill time
           0040::without injuring eternity.

         Note that  the blank  line was  not numbered.   To do
         this, use the "-ba" flag as shown in Example 2.

RELATED INFORMATION

     The following command:  "pr."

     The "Overview of International Character Support" in Man-
     aging the AIX Operating System.

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