coreutils: nl invocation

1 
1 3.3 ‘nl’: Number lines and write files
1 ======================================
1 
1 ‘nl’ writes each FILE (‘-’ means standard input), or standard input if
1 none are given, to standard output, with line numbers added to some or
1 all of the lines.  Synopsis:
1 
1      nl [OPTION]... [FILE]...
1 
1    ‘nl’ decomposes its input into (logical) page sections; by default,
1 the line number is reset to 1 at each logical page section.  ‘nl’ treats
1 all of the input files as a single document; it does not reset line
1 numbers or logical pages between files.
1 
1    A logical page consists of three sections: header, body, and footer.
1 Any of the sections can be empty.  Each can be numbered in a different
1 style from the others.
1 
1    The beginnings of the sections of logical pages are indicated in the
1 input file by a line containing exactly one of these delimiter strings:
1 
1 ‘\:\:\:’
1      start of header;
1 ‘\:\:’
1      start of body;
1 ‘\:’
1      start of footer.
1 
1    The two characters from which these strings are made can be changed
1 from ‘\’ and ‘:’ via options (see below), but the pattern and length of
1 each string cannot be changed.
1 
1    A section delimiter is replaced by an empty line on output.  Any text
1 that comes before the first section delimiter string in the input file
1 is considered to be part of a body section, so ‘nl’ treats a file that
1 contains no section delimiters as a single body section.
1 
11    The program accepts the following options.  Also see ⇒Common
 options.
1 
1 ‘-b STYLE’
1 ‘--body-numbering=STYLE’
1      Select the numbering style for lines in the body section of each
1      logical page.  When a line is not numbered, the current line number
1      is not incremented, but the line number separator character is
1      still prepended to the line.  The styles are:
1 
1      ‘a’
1           number all lines,
1      ‘t’
1           number only nonempty lines (default for body),
1      ‘n’
1           do not number lines (default for header and footer),
1      ‘pBRE’
1           number only lines that contain a match for the basic regular
11           expression BRE.  ⇒Regular Expressions (grep)Regular
           Expressions.
1 
1 ‘-d CD’
1 ‘--section-delimiter=CD’
1      Set the section delimiter characters to CD; default is ‘\:’.  If
1      only C is given, the second remains ‘:’.  (Remember to protect ‘\’
1      or other metacharacters from shell expansion with quotes or extra
1      backslashes.)
1 
1 ‘-f STYLE’
1 ‘--footer-numbering=STYLE’
1      Analogous to ‘--body-numbering’.
1 
1 ‘-h STYLE’
1 ‘--header-numbering=STYLE’
1      Analogous to ‘--body-numbering’.
1 
1 ‘-i NUMBER’
1 ‘--line-increment=NUMBER’
1      Increment line numbers by NUMBER (default 1).
1 
1 ‘-l NUMBER’
1 ‘--join-blank-lines=NUMBER’
1      Consider NUMBER (default 1) consecutive empty lines to be one
1      logical line for numbering, and only number the last one.  Where
1      fewer than NUMBER consecutive empty lines occur, do not number
1      them.  An empty line is one that contains no characters, not even
1      spaces or tabs.
1 
1 ‘-n FORMAT’
1 ‘--number-format=FORMAT’
1      Select the line numbering format (default is ‘rn’):
1 
1      ‘ln’
1           left justified, no leading zeros;
1      ‘rn’
1           right justified, no leading zeros;
1      ‘rz’
1           right justified, leading zeros.
1 
1 ‘-p’
1 ‘--no-renumber’
1      Do not reset the line number at the start of a logical page.
1 
1 ‘-s STRING’
1 ‘--number-separator=STRING’
1      Separate the line number from the text line in the output with
1      STRING (default is the TAB character).
1 
1 ‘-v NUMBER’
1 ‘--starting-line-number=NUMBER’
1      Set the initial line number on each logical page to NUMBER (default
1      1).
1 
1 ‘-w NUMBER’
1 ‘--number-width=NUMBER’
1      Use NUMBER characters for line numbers (default 6).
1 
1    An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1