PG(1,C) AIX Commands Reference PG(1,C)
-------------------------------------------------------------------------------
pg
PURPOSE
Formats files to the work station.
SYNTAX
+---------------+ +-----------------+ +--------+
pg ---| +-----------+ |---| one of |---| |---|
+-| -num |-+ | +-------------+ | +- file -+
^| -c || +-| +linenum |-+ ^ |
|| -e || | +/pattern/ | +------+
|| -f || +-------------+
|| -n ||
|| -p string ||
|| -s ||
|+-----------+|
+-------------+
DESCRIPTION
The pg command reads files and writes them to standard output one screen at a
time. If you specify file as - (minus) or run pg without arguments, the
command reads standard input. Each screen is followed by a prompt. If you
press the Enter key, the next page is displayed. The pg command lets you back
up to review something that has already been displayed.
To determine work station attributes, the pg command scans the file terminfo
for the work station type specified by the environment variable TERM. The
default type is dumb. See AIX Operating System Technical Reference for
information on terminfo.
SUBCOMMANDS
When pg pauses and issues its 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 pg works.
The following subcommands display a selected place in the file:
+num Displays the page num pages after the current page.
-num Displays the page num pages before the current page.
Processed November 8, 1990 PG(1,C) 1
PG(1,C) AIX Commands Reference PG(1,C)
l Scrolls the display one line forward.
num l Displays a screen with the specified line number at the top.
+num l Scrolls the display lines forward
-num l Scrolls the display num lines backward.
d Scrolls half a screen forward. Pressing Ctrl-D also does this.
-d Scrolls half a screen backward. Pressing -Ctrl-D also does this.
Ctrl-L Displays the current page again. A single period also does this.
The following commands search for text patterns in the text. You can use the
patterns described in "ed, red." They must always end with a new line
character, even if the -n is not used. In an expression such as [a-z], the
minus means "through" according to the current collating sequence. A collating
sequence may define equivalence classes for use in character ranges. See the
"Introduction to International Character Support" in Managing the AIX Operating
System for more information on collating sequences and equivalence classes.
[num]/pattern/
Search for the numth occurrence of pattern. The search begins
immediately after the current page and continues to the end of
the current file, without wrap around. The default for num is 1.
num^pattern^
num^pattern^
Search backward for the numth occurrence of pattern. The
searching begins immediately before the current page and
continues to the beginning of the current file, without wrap
around. The ^ (circumflex) is useful for the Adds 100 work
station, which cannot handle the ?. The default for num is 1.
After searching, pg normally displays the line found at the top of the screen.
You can change this by adding :m or b to the search command to leave the line
found in the middle or at the bottom of the window with all succeeding
subcommands. Use the suffix t to return to displaying the line with the
pattern to the top of the screen.
You can change the pg environment with the following subcommands:
[num]n Begins examining the numth next file in the command line. The
default num is 1.
[num]w Displays another window of text. If num is present, sets the
window size to num.
s file Saves the input in 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.
Processed November 8, 1990 PG(1,C) 2
PG(1,C) AIX Commands Reference PG(1,C)
h Displays an abbreviated summary of available subcommands.
q or Q Quits pg
!AIX-cmd Sends the specified AIX 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.
At any time when output is being sent to the work station, you can press the
QUIT WITH DUMP (Ctrl-V) or INTERRUPT (Ctrl-C) key. The pg command stops
sending output, and displays the shell prompt. Then you can enter any of the
subcommands.
Notes:
1. When you use pg in a pipe, an Interrupt is likely to end the other
commands in the pipe.
2. If work station tabs are not set every eight positions, unpredictable
results can occur.
3. When using pg in a pipe with other commands that change work station I/O
options, work station settings may not be restored correctly.
SEARCHING FOR PATTERNS
The following commands search for text patterns in the text. You can use the
patterns described under "ed, red." The commands must always end with a
new-line character, even if the -n flag is used. In an expression such as
[a-z], the minus means "through" according to the current collating sequence.
A collating sequence may define equivalence classes for use in character
ranges. See the "Introduction to International Character Support" in Managing
the AIX Operating System for more information on collating sequences and
equivalence classes.
[num]/pattern/ Searches for the numth occurrence of pattern. The search
begins immediately after the current page and continues
to the end of the current file, without wrapping around.
The default for num is 1.
num?pattern?
num?pattern? Searches backward for the numth occurrence of pattern.
The searching begins immediately before the current page
and continues to the beginning of the current file,
without wrapping around. The ^ (circumflex) is useful
for the Adds 100 work station, which cannot handle the ?.
The default for num is 1.
After completing its search, the pg command displays the line containing the
pattern at the top of the screen. You can change this by adding an m or b to
the search command; an m puts this line in the middle of the screen, and a b
Processed November 8, 1990 PG(1,C) 3
PG(1,C) AIX Commands Reference PG(1,C)
puts the line at the bottom of the window with all succeeding subcommands. Use
the suffix t to again display the line with the pattern at the top of the
screen.
CHANGING THE PG COMMAND ENVIRONMENT
You can change the pg environment with the following subcommands:
[num]n Begins examining the numth next file in the command line.
The default num is 1.
[num]p Begins examining the numth previous file on the command
line. The default num is 1.
[num]w Displays another window of text. If num is present, sets
the window size to num.
s file Saves the input in 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.
!AIX-cmd Sends the specified AIX command to the shell named in the
SHELL environment variable. If this shell 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.
Warning: Some output is lost when you press the QUIT WITH DUMP (Ctrl-V) or
INTERRUPT (Ctrl-C) key because any characters waiting in the output queue are
purged when the QUIT signal is received.
If standard output is not a work station, the pg command acts like the cat
command, except that a header displays before each file.
While waiting for work station input, pg stops running when you press INTERRUPT
(Ctrl-C). Between prompts, these signals interrupt the current task and place
you in the prompt mode.
FLAGS
-c Moves the cursor to the home position and clears the screen
before displaying each page. This flag is ignored if
clear_screen is not defined for your work station type in the
terminfo file.
-e Does not pause at the end of each file.
Processed November 8, 1990 PG(1,C) 4
PG(1,C) AIX Commands Reference PG(1,C)
-f Does not split lines. Normally, the pg command splits lines
longer than the width of the screen.
-n Stops processing when a pg command letter is entered. Normally,
commands must end with a new-line character.
-p string Uses string as the prompt. If the string contains a %d, the %d
is replaced by the current page number in the prompt. The
default prompt is : (colon). If string contains spaces, you
must quote it.
-s Highlights all messages and prompts.
+linenum Starts at linenum.
-num Specifies the number of lines in the window. On work stations
that contain 24 lines, the default is 23.
+/pattern/ Starts at the first line that contains pattern.
FILES
/usr/lib/terminfo/* Terminal information files.
/tmp/pg* Temporary files for the pg command.
RELATED INFORMATION
See the following commands: "ed, red" and "grep, egrep, fgrep."
See the terminfo file in AIX Operating System Technical Reference.
See "Introduction to International Character Support" in Managing the AIX
Operating System.
Processed November 8, 1990 PG(1,C) 5