sbase

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

nl.1 (2259B)


      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 or
     67 .Xr re_format 7 .
     68 .El
     69 .It Fl d Ar delim
     70 Set
     71 .Ar delim
     72 as the delimiter for logical pages.
     73 If
     74 .Ar delim
     75 is only one character,
     76 .Nm
     77 appends ":" to it.
     78 The default is "\e:".
     79 .It Fl i Ar num
     80 Set the increment between numbered lines to
     81 .Ar num .
     82 .It Fl l Ar num
     83 Set the number of adjacent blank lines to be considered as one to
     84 .Ar num .
     85 The default is 1.
     86 .It Fl n Ar format
     87 Set the line number output
     88 .Ar format
     89 to one of:
     90 .Bl -tag -width pstringXX
     91 .It ln
     92 Left justified.
     93 .It rn
     94 Right justified.
     95 This is the default.
     96 .It rz
     97 Right justified with leading zeroes.
     98 .El
     99 .It Fl s Ar sep
    100 Use
    101 .Ar sep
    102 to separate line numbers and lines.
    103 The default is "\et".
    104 .It Fl v Ar num
    105 Start counting lines from
    106 .Ar num .
    107 The default is 1.
    108 .It Fl w Ar num
    109 Set the width of the line number to
    110 .Ar num .
    111 The default is 6.
    112 .El
    113 .Sh SEE ALSO
    114 .Xr pr 1
    115 .Sh STANDARDS
    116 The
    117 .Nm
    118 utility is compliant with the
    119 .St -p1003.1-2013
    120 specification.