NAME
pg - Formats files for a tty display
SYNOPSIS
pg [-cefns] [-p string] [+line_number | +/pattern/] [-
number] [file ...]
The pg command reads the specified file or files (or stan-
dard input by default) and writes them to standard output
one screen at a time. At the end of each screen you can
display the next screen or enter various subcommands,
including those that let you back up to review something
that has already passed.
FLAGS
-c Moves the cursor to the home position and clears the
screen before each page. This flag is ignored if
clear_screen is not defined for your tty type in the
terminfo file.
-e Does not pause at the end of each file. However, pg
still pauses at the beginning of each file.
-f Does not split lines. Normally, pg splits (wraps) lines
longer than the screen width.
-n Stops processing when a pg command letter is entered.
Normally, commands must end with a newline character.
-p string
Uses string as the prompt. If the string contains %d,
%d is replaced by the current page number in the prompt.
The default prompt is : (colon). If string contains
spaces, you must quote it. In addition, if string con-
tains either the < or > characters, you must quote it;
otherwise, these characters are treated as shell
redirection commands.
-s Highlights all messages and prompts.
+line_number
Starts at line_number.
-number
Specifies the number of lines in the window.
+/pattern/
Starts at the first line that contains pattern.
DESCRIPTION
If you specify file as a - (dash) or run pg without argu-
ments, pg reads standard input. To determine tty attri-
butes, pg looks up the tty type specified by the TERM
environment variable in the terminfo database. The default
type is dumb.
At any time during the operation of pg, you can enter the
Quit (usually <Ctrl-\> ) or Interrupt (usually <Ctrl-c>) key
sequences. If pg is sending output, it interrupts output
and and displays the prompt, and you can then enter one of
the subcommands in the normal manner. If the prompt is
already displayed, the Quit and Interrupt sequences ter-
minate pg. (Note that on a high-speed display it may be
difficult to enter a Quit or Interrupt between prompts,
because the interval between them is so short.)
Note that some output is lost when when you use the Quit or
Interrupt sequences during output because any characters
waiting in the output queue are purged when the QUIT or
INTERRUPT signal is received. When you use pg in a pipe, an
Interrupt is likely to end the other commands in the pipe.
If standard output is not a tty, pg acts like the cat com-
mand, writing the input to standard output without any for-
matting or special treatment, except that a header is
displayed before each file.
If tty tabs are not set for every eight positions,
unpredictable results can occur.
SUBCOMMANDS
When pg pauses and displays its prompt, you can enter a sub-
command. Some of these subcommands change the display to a
particular place in the file, some search for specific pat-
terns in the text, and others change the environment in
which pg works.
Location Subcommands
The following commands display a selected place in the file:
number
Displays page number number.
+number
Displays the page number pages after the current page.
-number
Displays the page number pages before the current page.
l Scrolls the display one line forward.
numberl
Displays a screen with the specified line number at the
top.
+numberl
Scrolls the display number lines forward.
-numberl
Scrolls the display number lines backward.
d Scrolls half a screen forward. Pressing <Ctrl-d> (and
<Return> if you have not specified -n) has the same
effect.
-d Scrolls half a screen backward. Pressing - and then
<Ctrl-d> (and <Return> if you have not specified -n) has
the same effect.
+numberf
Skips number screens forward.
-numberf
Skips number screens backward.
<Ctrl-l>
Displays the current page again. A single . (dot) also
does this.
$ Displays the last page in the file. Do not use this
when the input is from a pipeline.
Search Subcommands
The following commands search for patterns in the text. You
can use the regular expressions described in grep. They
must always end with a newline character, even if the -n
flag is used. In an expression such as [a-z], the dash
means through according to the current collating sequence.
See "Using Internationalization Features" in the OSF/1
User's Guide for more information on collating sequences.
The collating sequence is determined by the value of the
LC_COLLATE environment variable.
[number]/pattern/
Searches for the number'th occurrence of pattern. The
search begins immediately after the current page and
continues to the end of the current file, without wrap-
ping around. The default for number is 1.
number?pattern?
or
number^pattern^
Searches backward for the number'th occurrence of pat-
tern. The search begins immediately before the current
page and continues to the beginning of the current file,
without wraparound. The ^ (circumflex) is useful for
the Adds 100 terminal, which cannot handle a ? (question
mark). The default for number 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.
Environment Subcommands
You can change the pg environment with the following subcom-
mands:
[number]n
Begins examining the number'th next file in the command
line. The default number is 1.
[number]p
Begins examining the number'th previous file on the com-
mand line. The default number is 1.
[number]w
Sets the window size to number. If number is not
present, displays another window of text.
[number]lz
Same as w.
s file
Saves the input in file. Only the current file being
examined is saved. This command must always end with a
newline character, even if you specify the -n flag.
h Displays an abbreviated summary of available subcom-
mands.
q or Q
Quits pg.
!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 newline character, even if the -n flag is used.
EXAMPLES
To look at the contents of file file1 one page at a time,
enter:
pg file1
FILES
/usr/share/lib/terminfo/?/*
Terminal capability database.
/tmp/pg* Temporary file used when input is from a pipe.
RELATED INFORMATION
Commands: cat(1), grep(1)/egrep(1)/fgrep(1),
more(1)/page(1).
Files: terminfo(4).
"Using Internationalization Features" in the OSF/1 User's
Guide.
Acknowledgement and Disclaimer