PG(1) DOMAIN/IX Reference Manual (SYS5) PG(1)
NAME
pg - file perusal filter for soft-copy terminals
USAGE
pg [ - number ] [ -pstring ] [ -cefns ] [ +linenumber ] [
+/pattern/ ] [ files ... ]
DESCRIPTION
The pg command is a filter that lets you examine files one
screenful at a time on a soft-copy terminal. A dash (-)
and/or any null arguments supplied in place of files causes
pg to read from the standard input. Each screenful is fol-
lowed by a prompt. If you type a carriage return, pg
displays another page; other possibilities are enumerated
below.
This command differs from other paginators in that it lets
you 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 ter-
minfo (4) database for the terminal type specified by the
TERM environment variable. If TERM is undefined, pg assumes
the terminal type dumb.
OPTIONS
-number Specify window size as number lines. (On
a terminal containing 24 lines, the
default window size is 23).
-p string Use string as the prompt. If the prompt
string contains a ``%d'', the first
occurrence of ``%d'' in the prompt is
replaced by the current page number when
the prompt is issued. The default
prompt string is a colon (:).
-c Home the cursor and clear the screen
before displaying each page. This
option is ignored if clear_screen is not
defined for this terminal type in the
terminfo(4) database.
-e Do not pause at the end of each file.
-f Inhibit line-splitting tendencies. Nor-
mally, pg splits lines longer than the
screen width, but some character
sequences in the text being displayed
(e.g., escape sequences for underlining)
generate undesirable results unless this
option is used.
Printed 1/27/86 PG-1
PG(1) DOMAIN/IX Reference Manual (SYS5) PG(1)
-n Cause an automatic end of command as
soon as a command letter is entered.
(Normally, commands must be terminated
by a <RETURN>.)
-s Print all messages and prompts in stan-
dout mode (usually inverse video).
+linenumber Start up at linenumber.
+/pattern/ Start up at the first line containing
the regular expression pattern.
COMMANDS
The responses that you may type when pg pauses can be
divided into three categories: those causing further
perusal, those that search, and those that modify the
perusal environment.
Commands that cause further perusal normally take a preced-
ing 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 com-
mand has a default address.
The perusal commands and their defaults are as follows:
(+1)<newline> or <blank> Display one page. The address is
specified in pages.
(+1) l With a relative address, simulate
scrolling of the screen, forward or
backward, the number of lines
specified. With an absolute
address, print a screenful begin-
ning at the specified line.
(+1) d or ^D Simulate scrolling half a screen
forward or backward.
The following perusal commands take no address.
. or ^L Redisplay the current page of text.
$ Display the last windowful in the file. Use
with caution when the input is a pipe.
PG-2 Printed 1/27/86
PG(1) DOMAIN/IX Reference Manual (SYS5) PG(1)
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 caret (^) nota-
tion is useful for terminals that cannot handle a ques-
tion mark (?) properly.
After searching, pg normally displays 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.
You can modify the perusal environment with the following
commands:
in Begin perusing the ith next file in the
command line. The i is an unsigned
number; default value is 1.
ip Begin perusing the ith previous file in
the command line. The i is an unsigned
number; default value is 1.
iw Display another window of text. If i is
present, set the window size to i.
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 <RETURN>, even
if the -n option is specified.
h Help by displaying an abbreviated sum-
mary of available commands.
q or Q Quit pg.
Printed 1/27/86 PG-3
PG(1) DOMAIN/IX Reference Manual (SYS5) PG(1)
!command Pass command to the shell whose name is
taken from the SHELL environment vari-
able. If this is not available, the
default shell is used. This command
must always be terminated by a <RETURN>,
even if the -n option is specified.
At any time when output is being sent to the terminal, you
can quit (normally CTRL-D) or interrupt (normally CTRL/I)
the process. If you do so, the pg program stops sending out-
put, and displays the prompt. You may then enter one of the
above commands in the normal manner. Unfortunately, some
output is lost when this is done, because any characters
waiting in the terminal's output queue are flushed when the
quit signal occurs.
If the standard output is not a terminal, pg acts like
cat(1), except that pg prints a header before each file (if
there is more than one file).
CAUTIONS
If you do not set terminal tabs every eight positions, pg
may produce undesirable results.
When using pg as a filter with another command that changes
the terminal I/O options, terminal settings may not be
restored correctly.
While waiting for terminal input, pg responds to BREAK, DEL,
and ^ by terminating execution. Between prompts, however,
these signals interrupt the filter's current task and place
the user in prompt mode. Use them with caution when input
is being read from a pipe, since an interrupt is likely to
terminate the other commands in the pipeline.
EXAMPLE
news | pg -p ``(Page %d):''
Use pg to help read system news.
FILES
/usr/lib/terminfo/?/*
terminal information database
/tmp/pg* temporary file when input is from a pipe
RELATED INFORMATION
crypt(1)
ed(1)
grep(1)
terminfo(4)
PG-4 Printed 1/27/86