pg(1) CLIX pg(1)
NAME
pg - Runs a file perusal filter for CRTs
SYNOPSIS
pg [-number] [-p string] [-cefns] [+linenumber] [+/pattern/] [file ... ]
FLAGS
-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 Positions the cursor at the ``home'' location and clears the
screen before displaying each page. This flag is ignored if
clear_screen is not defined for this terminal type in the
terminfo database.
-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
(for example, escape sequences for underlining) generate
undesirable results. The -f flag inhibits pg from splitting
lines.
-n Normally, commands must be terminated by pressing <Return>
or <Line Feed> This flag causes an automatic end of command
as soon as a command letter is entered.
-s Causes pg to display all messages and prompts in the
standout video mode (usually inverse video).
+linenumber Causes the command to start at the given linenumber.
+/pattern/ Causes the command to start at the first line containing the
regular expression pattern.
DESCRIPTION
The pg command is a filter which allows the examination of files one
screenful at a time on a CRT. (The filename and/or null arguments
indicate that pg should read from stdin.) Each screenful is followed by a
prompt. If the user types a carriage return, another page is displayed;
other possibilities are enumerated below.
2/94 - Intergraph Corporation 1
pg(1) CLIX pg(1)
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 database
for the terminal type specified by the environment variable $TERM. If
$TERM is not defined, the terminal type dumb is assumed.
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.
The perusal commands and their defaults are as follows:
[address]<Return>
[address]space bar
This causes one page to be displayed. The address is specified in
pages. The default address is +1.
[address]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 displays a screenful beginning at
the specified line. The default address is +1.
[address]d
[address]<Ctrl-D>
Simulates scrolling half a screen forward or backward. The default
address is +1.
The following perusal commands take no address:
.
<Ctrl-L> Typing a single dot 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.
The following commands are available for searching for text patterns in
the text. The regular expressions described in ed are available. They
must always be terminated by pressing <Return> even if the -n flag is
specified.
2 Intergraph Corporation - 2/94
pg(1) CLIX pg(1)
[i]/pattern[/] Searches forward for the ith (default i=1) occurrence of
a pattern. Searching begins immediately after the
current page and continues to the end of the current
file, without wrap-around.
[i]^pattern[^]
[i]?pattern[?] Searches backwards for the ith (default i=1) occurrence
of a 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 the line found at the top of the
screen. This can be modified by appending m or b to the search command to
leave the line found 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 can modify the environment of perusal with the following
commands:
in Begins perusing the ith next file in the command line. The i
is an unsigned number, default value is 1.
ip Begins perusing the ith previous file in the command line. The
i is an unsigned number, default is 1.
iw Displays another window of text. If the i is present, the
window size is set to i.
s filename Saves 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
pressing <Return> even if the -n flag is specified.
h Displays an abbreviated summary of available commands.
q
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 is used. This command must always be terminated
by pressing <Return> even if the -n flag is specified.
At any time when output is being sent to the terminal, the user can key in
<Ctrl-E> or press <Break> (the interrupt key). 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.
2/94 - Intergraph Corporation 3
pg(1) CLIX pg(1)
If stdout is not a terminal, then pg acts like the cat command, except
that a header is displayed before each file (if there is more than one).
EXAMPLES
1. A sample usage of pg in reading system news would be
news | pg -p "(Page %d):"
FILES
/usr/lib/terminfo/?/* Terminal information database
/tmp/pg* Temporary file when input is from a pipe
NOTES
When using pg as a filter with another command that changes the terminal
I/O options terminal settings may not be restored correctly.
CAUTIONS
While waiting for terminal input, pg responds to <Break>, <Delete>, and
<Ctrl-L> 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 Berkeley's more will find that the z and f commands are
available, and that the terminal /, ^, or ? may be omitted from the
searching commands. If terminal tabs are not set every eight positions,
undesirable results may occur.
DIAGNOSTICS
pg: pattern too long
A search pattern or other regular expression was too long.
pg: file is a directory
An argument to pg was a directory.
No previous or next file exists.
An n or p command was given, and no previous or next file exists.
EXIT VALUES
The pg command returns the following exit values:
1 If an error occured.
4 Intergraph Corporation - 2/94
pg(1) CLIX pg(1)
0 If the command completely successfully.
RELATED INFORMATION
Commands: ed(1), grep(1)
Files: terminfo(4)
2/94 - Intergraph Corporation 5