sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

nl.1 (2240B)


      1 .Dd 2020-05-15
      2 .Dt NL 1
      3 .Os sbase
      4 .Sh NAME
      5 .Nm nl
      6 .Nd line numbering filter
      7 .Sh SYNOPSIS
      8 .Nm
      9 .Op Fl p
     10 .Op Fl b Ar type
     11 .Op Fl d Ar delim
     12 .Op Fl f Ar type
     13 .Op Fl h Ar type
     14 .Op Fl i Ar num
     15 .Op Fl l Ar num
     16 .Op Fl n Ar format
     17 .Op Fl s Ar sep
     18 .Op Fl v Ar num
     19 .Op Fl w Ar num
     20 .Op Ar file
     21 .Sh DESCRIPTION
     22 .Nm
     23 reads lines from
     24 .Ar file
     25 and writes them to stdout, numbering non-empty lines.
     26 If no
     27 .Ar file
     28 is given
     29 .Nm
     30 reads from stdin.
     31 .Pp
     32 .Nm
     33 treats the input text as a collection of logical pages divided into
     34 logical page sections.
     35 Each logical page consists of a header section, a body
     36 section and a footer section.
     37 Sections may be empty.
     38 The start of each section is indicated by a single delimiting line, one of:
     39 .Bl -column "\e:\e:\e: " "header " -offset indent
     40 .It Em "Line" Ta Em "Start of"
     41 .It \e:\e:\e:	header
     42 .It \e:\e:	body
     43 .It \e:	footer
     44 .El
     45 .Pp
     46 If the input text contains no delimiting line then all of the input text
     47 belongs to a single logical page body section.
     48 .Sh OPTIONS
     49 .Bl -tag -width Ds
     50 .It Fl p
     51 Do not reset line number for logical pages.
     52 .It Fl h Ar type | Fl b Ar type | Fl f Ar type
     53 Define which lines to number in the head | body | footer section:
     54 .Bl -tag -width pstringXX
     55 .It a
     56 All lines.
     57 .It n
     58 No lines.
     59 .It t
     60 Only non-empty lines.
     61 This is the default.
     62 .It p Ns Ar expr
     63 Only lines matching
     64 .Ar expr
     65 according to
     66 .Xr regex 7 .
     67 .El
     68 .It Fl d Ar delim
     69 Set
     70 .Ar delim
     71 as the delimiter for logical pages.
     72 If
     73 .Ar delim
     74 is only one character,
     75 .Nm
     76 appends ":" to it.
     77 The default is "\e:".
     78 .It Fl i Ar num
     79 Set the increment between numbered lines to
     80 .Ar num .
     81 .It Fl l Ar num
     82 Set the number of adjacent blank lines to be considered as one to
     83 .Ar num .
     84 The default is 1.
     85 .It Fl n Ar format
     86 Set the line number output
     87 .Ar format
     88 to one of:
     89 .Bl -tag -width pstringXX
     90 .It ln
     91 Left justified.
     92 .It rn
     93 Right justified.
     94 This is the default.
     95 .It rz
     96 Right justified with leading zeroes.
     97 .El
     98 .It Fl s Ar sep
     99 Use
    100 .Ar sep
    101 to separate line numbers and lines.
    102 The default is "\et".
    103 .It Fl v Ar num
    104 Start counting lines from
    105 .Ar num .
    106 The default is 1.
    107 .It Fl w Ar num
    108 Set the width of the line number to
    109 .Ar num .
    110 The default is 6.
    111 .El
    112 .Sh SEE ALSO
    113 .Xr pr 1
    114 .Sh STANDARDS
    115 The
    116 .Nm
    117 utility is compliant with the
    118 .St -p1003.1-2013
    119 specification.