pg [ - Number ] [ -c ] [ -e ] [ -f ] [ -n ] [ -p String ] [ -s ] [ +LineNumber ] [ +/Pattern/ ] [ File ... ]
The pg command reads a file name from the File parameter and writes the file to standard output one screen at a time. If you specify a - (dash) as the File parameter, or run the pg command without options, the pg command reads standard input. Each screen is followed by a prompt. If you press the Enter key, another page is displayed. Subcommands used with the pg command let you review or search in the file.
To determine workstation attributes, the pg command scans the file for the workstation type specified by the TERM environment variable. The default type is dumb.
When the pg command pauses and issues a prompt, you can issue a subcommand. Some of these subcommands change the display to a particular place in the file, some search for specific patterns in the text, and others change the environment in which the pg command works.
The following subcommands display
a selected place in the file:
The following subcommands search for text patterns in the text. (You can also use the patterns described in the ed command.) They must always end with a new-line character, even if the -n flag is used.
In an expression such as
[k.a-z]k., the minus implies a range, as in a through
z, according to the current collating sequence. A collating sequence
defines equivalence classes for use in character ranges.
Number^Pattern^ | |
Searches backward for the occurrence of the Pattern value as specified by the Number variable. The searching begins immediately before the current page and continues to the beginning of the current file, without wraparound. The default for the Number variable is 1. The ^ notation is useful for Adds 100 terminals which will not properly handle the ? notation. |
After searching, the pg command displays the line with the matching pattern at the top of the screen. You can change the position of the display by adding the m or b suffix to the search command. The m suffix displays the line with the matching pattern in the middle of the screen for all succeeding subcommands. The b suffix displays the line with the matching pattern at the bottom of the screen for all succeeding subcommands. The t suffix displays the line with the matching pattern at the top of the screen again.
You can change the pg
command environment with the following subcommands:
[Number]n | Begins examining the next file in the command line, as specified by the Number variable. The default for the Number variable is first. |
[Number]p | Begins examining the previous file on the command line, as specified by the Number variable. The default for the Number variable is first. |
[Number]w | Displays another window of text. If the Number variable is specified, sets the window size to the number of lines it specifies. This subcommand is the same as the [Number]z subcommand. |
[Number]z | Displays another window of text. If the Number variable is specified, sets the window size to the number of lines it specifies. This subcommand is the same as the [Number]w subcommand. |
s File | Saves the input in the specified file. Only the current file being examined is saved. This command must always end with a new-line character, even if you specify the -n flag. |
h | Displays an abbreviated summary of available subcommands. |
q or Q | Quits the pg command. |
!Command | Sends the specified command to the shell named in the SHELL environment variable. If this is not available, the default shell is used. This command must always end with a new-line character, even if the -n flag is used. |
Attention:
At any time output is being sent to the workstation, you can press the QUIT WITH DUMP or INTERRUPT key sequence. This causes the pg command to stop sending output and displays the prompt. Then you can enter one of the preceding subcommands at the command prompt.
If standard output is not a workstation, the pg command acts like the cat command, except that a header is displayed before each file.
While waiting for workstation input, the pg command stops running when you press the INTERRUPT key sequence. Between prompts these signals interrupt the current task and place you in the prompt mode.
This command returns the
following exit values:
0 | Successful completion. |
>0 | An error occurred. |
To look at the contents of a file one page at a time, enter:
pg filename
/usr/bin/pg | Contains the pg command. |
/usr/share/lib/terminfo/* | Contains the terminfo file that defines terminal types. |
/tmp/pg* | Contains the temporary file created when using pg command. |
The cat command, ed command, grep command.
File and Directory Access Modes in the AIX 5L Version 5.1 System Management Guide: Operating System and Devices.
Input and Output Redirection Overview and Shells Overview in the AIX 5L Version 5.1 System User's Guide: Operating System and Devices.
Files Overview in the AIX 5L Version 5.1 System User's Guide: Operating System and Devices.