{
    "mode": "info",
    "parameter": "nl",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/nl/json",
    "generated": "2026-11-11T09:40:49Z",
    "sections": {
        "File: coreutils.info,  Node: nl invocation,  Next: od invocation,  Prev: tac invocation,  Up: Output of entire files": {
            "content": "",
            "subsections": [
                {
                    "name": "3.3 'nl': Number lines and write files",
                    "content": "'nl' writes each FILE ('-' means standard input), or standard input if\nnone are given, to standard output, with line numbers added to some or\nall of the lines.  Synopsis:\n\nnl [OPTION]... [FILE]...\n\n'nl' decomposes its input into (logical) page sections; by default,\nthe line number is reset to 1 at each logical page section.  'nl' treats\nall of the input files as a single document; it does not reset line\nnumbers or logical pages between files.\n\nA logical page consists of three sections: header, body, and footer."
                }
            ]
        },
        "Any of the sections can be empty.  Each can be numbered in a different": {
            "content": "style from the others.\n\nThe beginnings of the sections of logical pages are indicated in the\ninput file by a line containing exactly one of these delimiter strings:\n\n'\\:\\:\\:'\nstart of header;\n'\\:\\:'\nstart of body;\n'\\:'\nstart of footer.\n\nThe characters from which these strings are made can be changed from\n'\\' and ':' via options (see below), but the pattern of each string\ncannot be changed.\n\nA section delimiter is replaced by an empty line on output.  Any text\nthat comes before the first section delimiter string in the input file\nis considered to be part of a body section, so 'nl' treats a file that\ncontains no section delimiters as a single body section.\n\nThe program accepts the following options.  Also see *note Common\noptions::.\n\n'-b STYLE'\n'--body-numbering=STYLE'\nSelect the numbering style for lines in the body section of each\nlogical page.  When a line is not numbered, the current line number\nis not incremented, but the line number separator character is\nstill prepended to the line.  The styles are:\n\n'a'\nnumber all lines,\n't'\nnumber only nonempty lines (default for body),\n'n'\ndo not number lines (default for header and footer),\n'pBRE'\nnumber only lines that contain a match for the basic regular\nexpression BRE.  *Note Regular Expressions: (grep)Regular\nExpressions.\n\n'-d CD'\n'--section-delimiter=CD'\nSet the section delimiter characters to CD; default is '\\:'.  If\nonly C is given, the second remains ':'.  As a GNU extension more\nthan two characters can be specified, and also if CD is empty ('-d\n'''), then section matching is disabled.  (Remember to protect '\\'\nor other metacharacters from shell expansion with quotes or extra\nbackslashes.)\n\n'-f STYLE'\n'--footer-numbering=STYLE'\nAnalogous to '--body-numbering'.\n\n'-h STYLE'\n'--header-numbering=STYLE'\nAnalogous to '--body-numbering'.\n\n'-i NUMBER'\n'--line-increment=NUMBER'\nIncrement line numbers by NUMBER (default 1).  NUMBER can be\nnegative to decrement.\n\n'-l NUMBER'\n'--join-blank-lines=NUMBER'\nConsider NUMBER (default 1) consecutive empty lines to be one\nlogical line for numbering, and only number the last one.  Where\nfewer than NUMBER consecutive empty lines occur, do not number\nthem.  An empty line is one that contains no characters, not even\nspaces or tabs.\n\n'-n FORMAT'\n'--number-format=FORMAT'\nSelect the line numbering format (default is 'rn'):\n\n'ln'\nleft justified, no leading zeros;\n'rn'\nright justified, no leading zeros;\n'rz'\nright justified, leading zeros.\n\n'-p'\n'--no-renumber'\nDo not reset the line number at the start of a logical page.\n\n'-s STRING'\n'--number-separator=STRING'\nSeparate the line number from the text line in the output with\nSTRING (default is the TAB character).\n\n'-v NUMBER'\n'--starting-line-number=NUMBER'\nSet the initial line number on each logical page to NUMBER (default\n1).  The starting NUMBER can be negative.\n\n'-w NUMBER'\n'--number-width=NUMBER'\nUse NUMBER characters for line numbers (default 6).\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}