{
    "mode": "info",
    "parameter": "pr",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/pr/json",
    "generated": "2026-07-29T01:36:36Z",
    "sections": {
        "File: coreutils.info,  Node: pr invocation,  Next: fold invocation,  Prev: fmt invocation,  Up: Formatting file contents": {
            "content": "",
            "subsections": [
                {
                    "name": "4.2 'pr': Paginate or columnate files for printing",
                    "content": "'pr' writes each FILE ('-' means standard input), or standard input if\nnone are given, to standard output, paginating and optionally outputting\nin multicolumn format; optionally merges all FILEs, printing all in\nparallel, one per column.  Synopsis:\n\npr [OPTION]... [FILE]...\n\nBy default, a 5-line header is printed at each page: two blank lines;\na line with the date, the file name, and the page count; and two more\nblank lines.  A footer of five blank lines is also printed.  The default\nPAGELENGTH is 66 lines.  The default number of text lines is therefore\n56.  The text line of the header takes the form 'DATE STRING PAGE', with\nspaces inserted around STRING so that the line takes up the full\nPAGEWIDTH.  Here, DATE is the date (see the '-D' or '--date-format'\noption for details), STRING is the centered header string, and PAGE\nidentifies the page number.  The 'LCMESSAGES' locale category affects\nthe spelling of PAGE; in the default C locale, it is 'Page NUMBER' where\nNUMBER is the decimal page number.\n\nForm feeds in the input cause page breaks in the output.  Multiple\nform feeds produce empty pages.\n\nColumns are of equal width, separated by an optional string (default\nis 'space').  For multicolumn output, lines will always be truncated to\nPAGEWIDTH (default 72), unless you use the '-J' option.  For single\ncolumn output no line truncation occurs by default.  Use '-W' option to\ntruncate lines in that case.\n\nThe program accepts the following options.  Also see *note Common\noptions::.\n\n'+FIRSTPAGE[:LASTPAGE]'\n'--pages=FIRSTPAGE[:LASTPAGE]'\nBegin printing with page FIRSTPAGE and stop with LASTPAGE.\nMissing ':LASTPAGE' implies end of file.  While estimating the\nnumber of skipped pages each form feed in the input file results in\na new page.  Page counting with and without '+FIRSTPAGE' is\nidentical.  By default, counting starts with the first page of\ninput file (not first page printed).  Line numbering may be altered\nby '-N' option.\n\n'-COLUMN'\n'--columns=COLUMN'\nWith each single FILE, produce COLUMN columns of output (default is\n1) and print columns down, unless '-a' is used.  The column width\nis automatically decreased as COLUMN increases; unless you use the\n'-W/-w' option to increase PAGEWIDTH as well.  This option might\nwell cause some lines to be truncated.  The number of lines in the\ncolumns on each page are balanced.  The options '-e' and '-i' are\non for multiple text-column output.  Together with '-J' option\ncolumn alignment and line truncation is turned off.  Lines of full\nlength are joined in a free field format and '-S' option may set\nfield separators.  '-COLUMN' may not be used with '-m' option.\n\n'-a'\n'--across'\nWith each single FILE, print columns across rather than down.  The\n'-COLUMN' option must be given with COLUMN greater than one.  If a\nline is too long to fit in a column, it is truncated.\n\n'-c'\n'--show-control-chars'\nPrint control characters using hat notation (e.g., '^G'); print\nother nonprinting characters in octal backslash notation.  By\ndefault, nonprinting characters are not changed.\n\n'-d'\n'--double-space'\nDouble space the output.\n\n'-D FORMAT'\n'--date-format=FORMAT'\nFormat header dates using FORMAT, using the same conventions as for\nthe command 'date +FORMAT'.  *Note date invocation::.  Except for\ndirectives, which start with '%', characters in FORMAT are printed\nunchanged.  You can use this option to specify an arbitrary string\nin place of the header date, e.g., '--date-format=\"Monday\nmorning\"'.\n\nThe default date format is '%Y-%m-%d %H:%M' (for example,\n'2001-12-04 23:59'); but if the 'POSIXLYCORRECT' environment\nvariable is set and the 'LCTIME' locale category specifies the\nPOSIX locale, the default is '%b %e %H:%M %Y' (for example, 'Dec  4\n23:59 2001'.\n\nTimestamps are listed according to the time zone rules specified by\nthe 'TZ' environment variable, or by the system default rules if\n'TZ' is not set.  *Note Specifying the Time Zone with 'TZ':\n(libc)TZ Variable.\n\n'-e[IN-TABCHAR[IN-TABWIDTH]]'\n'--expand-tabs[=IN-TABCHAR[IN-TABWIDTH]]'\nExpand TABs to spaces on input.  Optional argument IN-TABCHAR is\nthe input tab character (default is the TAB character).  Second\noptional argument IN-TABWIDTH is the input tab character's width\n(default is 8).\n\n'-f'\n'-F'\n'--form-feed'\nUse a form feed instead of newlines to separate output pages.  This\ndoes not alter the default page length of 66 lines.\n\n'-h HEADER'\n'--header=HEADER'\nReplace the file name in the header with the centered string\nHEADER.  When using the shell, HEADER should be quoted and should\nbe separated from '-h' by a space.\n\n'-i[OUT-TABCHAR[OUT-TABWIDTH]]'\n'--output-tabs[=OUT-TABCHAR[OUT-TABWIDTH]]'\nReplace spaces with TABs on output.  Optional argument OUT-TABCHAR\nis the output tab character (default is the TAB character).  Second\noptional argument OUT-TABWIDTH is the output tab character's width\n(default is 8).\n\n'-J'\n'--join-lines'\nMerge lines of full length.  Used together with the column options\n'-COLUMN', '-a -COLUMN' or '-m'.  Turns off '-W/-w' line\ntruncation; no column alignment used; may be used with\n'--sep-string[=STRING]'.  '-J' has been introduced (together with\n'-W' and '--sep-string') to disentangle the old (POSIX-compliant)\noptions '-w' and '-s' along with the three column options.\n\n'-l PAGELENGTH'\n'--length=PAGELENGTH'\nSet the page length to PAGELENGTH (default 66) lines, including\nthe lines of the header [and the footer].  If PAGELENGTH is less\nthan or equal to 10, the header and footer are omitted, as if the\n'-t' option had been given.\n\n'-m'\n'--merge'\nMerge and print all FILEs in parallel, one in each column.  If a\nline is too long to fit in a column, it is truncated, unless the\n'-J' option is used.  '--sep-string[=STRING]' may be used.  Empty\npages in some FILEs (form feeds set) produce empty columns, still\nmarked by STRING.  The result is a continuous line numbering and\ncolumn marking throughout the whole merged file.  Completely empty\nmerged pages show no separators or line numbers.  The default\nheader becomes 'DATE PAGE' with spaces inserted in the middle; this\nmay be used with the '-h' or '--header' option to fill up the\nmiddle blank part.\n\n'-n[NUMBER-SEPARATOR[DIGITS]]'\n'--number-lines[=NUMBER-SEPARATOR[DIGITS]]'\nProvide DIGITS digit line numbering (default for DIGITS is 5).\nWith multicolumn output the number occupies the first DIGITS column\npositions of each text column or only each line of '-m' output.\nWith single column output the number precedes each line just as\n'-m' does.  Default counting of the line numbers starts with the\nfirst line of the input file (not the first line printed, compare\nthe '--page' option and '-N' option).  Optional argument\nNUMBER-SEPARATOR is the character appended to the line number to\nseparate it from the text followed.  The default separator is the\nTAB character.  In a strict sense a TAB is always printed with\nsingle column output only.  The TAB width varies with the TAB\nposition, e.g., with the left MARGIN specified by '-o' option.\nWith multicolumn output priority is given to 'equal width of output\ncolumns' (a POSIX specification).  The TAB width is fixed to the\nvalue of the first column and does not change with different values\nof left MARGIN.  That means a fixed number of spaces is always\nprinted in the place of the NUMBER-SEPARATOR TAB.  The tabification\ndepends upon the output position.\n\n'-N LINENUMBER'\n'--first-line-number=LINENUMBER'\nStart line counting with the number LINENUMBER at first line of\nfirst page printed (in most cases not the first line of the input\nfile).\n\n'-o MARGIN'\n'--indent=MARGIN'\nIndent each line with a margin MARGIN spaces wide (default is\nzero).  The total page width is the size of the margin plus the\nPAGEWIDTH set with the '-W/-w' option.  A limited overflow may\noccur with numbered single column output (compare '-n' option).\n\n'-r'\n'--no-file-warnings'\nDo not print a warning message when an argument FILE cannot be\nopened.  (The exit status will still be nonzero, however.)\n\n'-s[CHAR]'\n'--separator[=CHAR]'\nSeparate columns by a single character CHAR.  The default for CHAR\nis the TAB character without '-w' and 'no character' with '-w'.\nWithout '-s' the default separator 'space' is set.  '-s[char]'\nturns off line truncation of all three column options\n('-COLUMN'|'-a -COLUMN'|'-m') unless '-w' is set.  This is a\nPOSIX-compliant formulation.\n\n'-S[STRING]'\n'--sep-string[=STRING]'\nUse STRING to separate output columns.  The '-S' option doesn't\naffect the '-W/-w' option, unlike the '-s' option which does.  It\ndoes not affect line truncation or column alignment.  Without '-S',\nand with '-J', 'pr' uses the default output separator, TAB.\nWithout '-S' or '-J', 'pr' uses a 'space' (same as '-S\" \"').  If no\n'STRING' argument is specified, '\"\"' is assumed.\n\n'-t'\n'--omit-header'\nDo not print the usual header [and footer] on each page, and do not\nfill out the bottom of pages (with blank lines or a form feed).  No\npage structure is produced, but form feeds set in the input files\nare retained.  The predefined pagination is not changed.  '-t' or\n'-T' may be useful together with other options; e.g.: '-t -e4',\nexpand TAB characters in the input file to 4 spaces but don't make\nany other changes.  Use of '-t' overrides '-h'.\n\n'-T'\n'--omit-pagination'\nDo not print header [and footer].  In addition eliminate all form\nfeeds set in the input files.\n\n'-v'\n'--show-nonprinting'\nPrint nonprinting characters in octal backslash notation.\n\n'-w PAGEWIDTH'\n'--width=PAGEWIDTH'\nSet page width to PAGEWIDTH characters for multiple text-column\noutput only (default for PAGEWIDTH is 72).  The specified\nPAGEWIDTH is rounded down so that columns have equal width.\n'-s[CHAR]' turns off the default page width and any line truncation\nand column alignment.  Lines of full length are merged, regardless\nof the column options set.  No PAGEWIDTH setting is possible with\nsingle column output.  A POSIX-compliant formulation.\n\n'-W PAGEWIDTH'\n'--pagewidth=PAGEWIDTH'\nSet the page width to PAGEWIDTH characters, honored with and\nwithout a column option.  With a column option, the specified\nPAGEWIDTH is rounded down so that columns have equal width.  Text\nlines are truncated, unless '-J' is used.  Together with one of the\nthree column options ('-COLUMN', '-a -COLUMN' or '-m') column\nalignment is always used.  The separator options '-S' or '-s' don't\ndisable the '-W' option.  Default is 72 characters.  Without '-W\nPAGEWIDTH' and without any of the column options NO line\ntruncation is used (defined to keep downward compatibility and to\nmeet most frequent tasks).  That's equivalent to '-W 72 -J'.  The\nheader line is never truncated.\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n"
                }
            ]
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}