Linux pr command - Prints the desired page number or focus for the specified file note

Linux pr command: Prints the desired page number or focus for the specified file note

Linux pr command Function Description

Use the pr command to print the desired page number or focus for a given document attachment.

Linux pr command Syntax

pr [Option] [File]

The meaning of each option in the command is shown in the table.

Option Description
-a Set each column to output from top to bottom, use with -<Columns> option
-c Use header markers (^G) and octal backslash markers
-d Doubling the output blank area
-l<page length> Use the number of lines of the specified page length (default 66)
-r Ignore warnings when files cannot be opened
-t Ignore headers and footers
-v Use octal backslash markers
-D<Format> Use a header date that follows the specified format
-F or -f Use exit page markers instead of new lines as page separators (3 lines when using the -F option, 5 lines when not used)
-w<Page width> Output for multi-column pages will be set to the specified number of characters (default 72)
-N<Format> Start counting from the first line of the first page with the specified number
-h<Header> Use the specified character centered in the header instead of the file name
-o<Indent amount> Indent each line by a number of spaces, default is 0
-<Columns> Outputs the specified number of columns. If the -a option is specified, it will print from top to bottom. The program will automatically equalize the number of rows occupied by each column on each page
-e<Char[Width]> Expand the entered characters (tabs) to tab width
-m Show all files on the same line, one column for each file, split lines, but combine lines to full length when using the -J option
-J Merge entire lines, turn off line truncation with the -W option, do not use column adjustment, use –sep-string=[String] to set the separator
-s<CHAR> Columns are separated by a single character, the default is a tab when the -w option is not attached, otherwise it is empty
-S<String> Use the specified string for column breaks, without the -S option the default tab TAB is used as a separator, used with the -J option and spaces (equal to -S "") has no effect on the column break options
-T Ignore headers and footers and remove all page breaks according to the settings in the input file
-n<Separator [digits]> Display line number, using the specified (default 5) digits, followed by a separator (default TAB) to count from the first line of the input file by default
-i<Char[Width]> Use the specified characters (or tabs) instead of spaces insufficient to the specified tab width (default 8)

Linux pr command Demo

Annotate the /root/install.log file to print the desired page number or focus

[root@rhel ~]# pr /root/install.log
2013-08-18 21:46              /root/install.log              Page 1
Install libgcc-4.4.7-3.el6.x86_64
warning: libgcc-4.4.7-3.el6.x86_64: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Install fontpackages-filesystem-1.41-1.1.el6.noarch
Install m17n-db-1.5.5-1.1.el6.noarch
Install ca-certificates-2010.63-3.el6_1.5.noarch
Install setup-2.8.14-20.el6.noarch
Install liberation-fonts-common-1.05.1.20090721-5.el6.noarch
Install xkeyboard-config-2.6-6.el6.noarch
Install xml-common-0.6.3-32.el6.noarch
Install iso-codes-3.16-2.el6.noarch
Install filesystem-2.4.30-3.el6.x86_64
Install dejavu-fonts-common-2.30-2.el6.noarch
Install tzdata-2012j-1.el6.noarch
........................

Print the desired page number or focus for the /root/apidemos.com.txt file comment, outputting the specified 2 columns

[root@rhel ~]# pr -2 /root/apidemos.com.txt

Output:

Linux pr command

Like(1)

Related

Linux Login Logout Command
Linux login commandLinux logout commandLinux nologin commandLinux exit commandLinux sulogin commandLinux rlogin commandLinux poweroff commandLinux ctrlaltdel CommandLinux shutdown commandLinux halt commandLinux reboot commandLinux init commandLinux runlevel commandLinux telinit command
Linux File Management Command
Linux cat commandLinux tac commandLinux nl commandLinux more commandLinux less commandLinux head commandLinux tail commandLinux rev commandLinux fold commandLinux fmt commandLinux expand commandLinux pr commandLinux sort commandLinux uniq commandLinux cut commandLinux comm commandLinux diff commandLinux join commandLinux diff3 commandLinux cmp commandLinux colrm commandLinux paste commandLinux mkdir commandLinux tr commandLinux split commandLinux csplit commandLinux tee commandLinux unexpand commandLinux patch commandLinux awk commandLinux sed commandLinux od commandLinux pwd commandLinux cd commandLinux ls commandLinux dir commandLinux dirs commandLinux touch commandLinux rmdir commandLinux cp commandLinux mv commandLinux rm commandLinux install commandLinux tmpwatch commandLinux file commandLinux du commandLinux wc commandLinux tree commandLinux cksum commandLinux md5sum commandLinux sum commandLinux dirname commandLinux mkfifo Command
Cron Expressions
Cron Expression to Run Every Day at 12 PMUnderstanding Vue Cron ExpressionsUnderstanding JS Cron ExpressionsA Comprehensive Guide to Cron Expressions for Scheduled TasksUnderstanding Linux Cron ExpressionsUnderstanding Quartz Cron ExpressionsCron ExpressionCron Time ExpressionCron Expression ParsingCron Expression: Executing a Task Every SecondCron Expression for Every Minute ExecutionCron Expression to Execute Every 10 MinutesCron Expression: Executing Every HourCron Expression to Execute Once a YearCron Expression: How to Schedule a Task to Run Daily at Midnight?