pg(1) DG/UX R4.11MU05 pg(1)
NAME
pg - display file forward or backward one screenful at a time
SYNOPSIS
pg [-number] [-p string] [-cefns] [+ linenumber] [+/pattern/] [files
...]
DESCRIPTION
The pg command is a filter which allows the examination of files one
screenful at a time on a CRT terminal. (The file name - and/or NULL
arguments indicate that pg should read from the standard input.)
Each screenful is followed by a prompt. If the user types a carriage
return, another page is displayed; other possibilities are enumerated
below.
This command is different from previous paginators in that it allows
you to back up and review something that has already passed. The
method for doing this is explained below.
In order to determine terminal attributes, pg scans the terminfo(4)
data base for the terminal type specified by the environment variable
TERM. If TERM is not defined, the terminal type dumb is assumed.
The command line options are:
-number
An integer specifying the size (in lines) of the window that
pg is to use instead of the default. (On a terminal
containing 24 lines, the default window size is 23).
-p string
Causes pg to use string as the prompt. If the prompt string
contains a ``%d'', the first occurrence of ``%d'' in the
prompt will be replaced by the current page number when the
prompt is issued. The default prompt string is ``:''.
-c Home the cursor and clear the screen before displaying each
page. This option is ignored if clearscreen is not defined
for your terminal type in the terminfo(4) data base.
-e Causes pg not to pause at the end of each file.
-f Normally, pg splits lines longer than the screen width, but
some sequences of characters in the text being displayed
(e.g., escape sequences for underlining) generate undesirable
results. The -f option inhibits pg from splitting lines. The
-f option is recommended when piping man output through pg;
otherwise, pg may become confused by nonprinting video
attribute characters typically displayed to a terminal screen.
-n Normally, commands must be terminated by a newline character.
This option causes an automatic end of command as soon as a
command letter is entered.
-s Causes pg to print all messages and prompts in standout mode
(usually reverse video).
+linenumber
Start up at linenumber.
+/pattern/
Start up at the first line containing the regular expression
pattern.
The responses that may be typed when pg pauses can be divided into
three categories: those causing further perusal, those that search,
and those that modify the perusal environment.
Commands which cause further perusal normally take a preceding
address, an optionally signed number indicating the point from which
further text should be displayed. This address is interpreted in
either pages or lines depending on the command. A signed address
specifies a point relative to the current page or line, and an
unsigned address specifies an address relative to the beginning of
the file. Each command has a default address that is used if none is
provided; it is shown in parentheses below. Control characters are
indicated with a caret, e.g., ^c for Control-C.
The perusal commands and their defaults are as follows:
(+1)<newline> or <space>
This causes one page to be displayed. The address is
specified in pages.
(+1) l With a relative address this causes pg to simulate scrolling
the screen, forward or backward, the number of lines
specified. With an absolute address this command prints a
screenful beginning at the specified line.
(+1) d or ^D
Simulates scrolling half a screen forward or backward.
The following perusal commands take no address.
. or ^L
Typing a single period causes the current page of text to be
redisplayed.
$ Displays the last windowful in the file. Use with caution
when the input is a pipe because pg will wait until the
process writing to the pipe is completely finished before
displaying anything.
The following commands are available for searching for text patterns
in the text. The regular expressions described in ed(1) are
available. They must always be terminated by a newline, even if the
-n option is specified.
[i]/pattern/
Search forward for the ith (default i=1) occurrence of
pattern. Searching begins immediately after the current page
and continues to the end of the current file, without wrap-
around.
[i]^pattern^
[i]?pattern?
Search backwards for the ith (default i=1) occurrence of
pattern. Searching begins immediately before the current page
and continues to the beginning of the current file, without
wrap-around. The ^ notation is useful for Adds 100 terminals
which will not properly handle the ?.
After searching, pg will normally display a screen of text with the
found line at the top of the screen. This can be modified by
appending m or b to the search command to position the found line in
the middle or at the bottom of the window from now on. The suffix t
can be used to restore the original situation.
The user of pg can modify the environment of perusal with the
following commands:
[i]n Begin perusing the ith next file in the command line. The i
is an unsigned number, and its default value is 1.
[i]p Begin perusing the ith previous file in the command line. The
prompt reads Next File. The i is an unsigned number, and its
default is 1.
[i]w Display another window of text. If i is present, set the
window size to i. (The actual size will be i-1).
s filename
Save the input in the named file. Only the current file being
perused is saved. The white space between the s and filename
is optional. This command must always be terminated by a
newline, even if the -n option is specified.
h Provide help by displaying an abbreviated summary of available
commands.
q or Q Quit pg.
!command
Command is passed to the shell, whose name is taken from the
SHELL environment variable. If this is not available, the
default shell /bin/sh is used. This command must always be
terminated by a newline, even if the -n option is specified.
At any time when output is being sent to the terminal, the user can
type the quit key (normally control-\) or the interrupt (break) key
to interrupt the display. This causes pg to stop sending output and
display the prompt. The user may then enter one of the above
commands in the normal manner. Unfortunately, some output is lost
when this is done, due to the fact that any characters waiting in the
terminal's output queue are flushed when the quit signal occurs.
If the standard output is not a tty device, then pg acts just like
cat(1), except that a header is printed before each file if there is
more than one.
International Features
pg can process files containing characters from supplementary code
sets. Searches are performed on characters, not on individual bytes.
pg wraps lines longer than the screenwidth at character boundaries
instead of individual bytes; therefore multibyte characters remain
intact.
The prompt string with option -p can include characters from
supplementary code sets.
EXAMPLE
A sample usage of pg in reading system news would be
news | pg -p "(Page %d):"
NOTES
While waiting for terminal input, pg responds to interrupt and quit
characters by terminating execution. Between prompts, however, these
signals interrupt pg's current task and place the user in prompt
mode. These should be used with caution when input is being read
from a pipe, since an interrupt is likely to terminate the other
commands in the pipeline.
Users of more(1) will find that the z and f commands are available,
and that the terminating /, ^, or ? character may be omitted from the
searching commands.
FILES
/usr/lib/terminfo/?/* Terminal information data base
/tmp/pg* Temporary file when input is from a pipe
SEE ALSO
crypt(1), ed(1), more(1), cat(1).
terminfo(4)
BUGS
If terminal tabs are not set every eight positions, undesirable
results may occur.
When using pg as a filter with another command that changes the
terminal I/O options (e.g., crypt(1)), terminal settings may not be
restored correctly.
Licensed material--property of copyright holder(s)