pg(1) pg(1)
NAME
pg - file perusal filter
SYNOPSIS
pg [-number] [-p string] [option ...] [filename ...]
DESCRIPTION
pg writes files to the standard output. If the standard output is a
terminal, you can view the files by scrolling backward or forward one
page at a time.
pg displays a colon (:) as the default prompt at the bottom of each
screen. You respond to this prompt by entering a command. The command
you select determines which page is displayed next (see COMMANDS DUR-
ING A PG SESSION).
A character that follows a tab is displayed at the next tab stop; the
tab spacing is assumed to be eight characters.
If the standard output is not a terminal, the file is not subdivided
into pages, and no commands may be entered. pg then acts like the cat
utility, except that if there is more than one file, pg prints a
header for each file to identify it.
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.
OPTIONS
No argument specified:
pg reads from the standard input and writes this input a page at
a time to the standard output.
-number
Specifies the number of screen lines to be treated as a page. The
last line of one pageful is made the first line of the next.
Unless you use the -f option, pg splits lines longer than the
screen width. Each line on the screen is thus treated as a
separate line.
number
Number of lines to be used.
number=1: same as number=2; thus a page always has at least
two lines.
During a pg session the window size can be changed with the w
command (see Miscellaneous commands).
Page 1 Reliant UNIX 5.44 Printed 11/98
pg(1) pg(1)
-number not specified:
The default window size is 23 lines.
-p string
Changes the prompt (or prompt string) for commands (see COMMANDS
DURING A PG SESSION).
string
Is the new prompt string. If string includes the character
sequence %d, the first occurrence of %d in string will be
replaced by the current page number when pg issues the
prompt string.
-p string not specified:
The default prompt is a colon (:).
option may be:
-c Clears the screen before displaying a new page.
-c not specified:
pg scrolls the previous page upward until the first line of the
new page is positioned at the second line of the screen.
-e Causes pg not to pause at the end of each file; exits if no
further files exist.
-e not specified:
The last line of a file is usually followed by (EOF) and the
prompt.
Striking the <RETURN> key in response to the prompt causes pg to
display the next file, or to terminate if there are no more
files.
-f Inhibits pg from splitting lines longer than the screen width.
If the splitting of overlength lines is dictated by the hardware,
the -f option cannot be used to override this feature. pg will
count the lines as if no splitting occurred; however, the start
of the affected page will no longer be visible on the screen.
-f not specified:
pg splits lines that extend beyond the right edge of the screen.
Each line on the screen is thus treated as a separate line.
Page 2 Reliant UNIX 5.44 Printed 11/98
pg(1) pg(1)
-n Automatic newline; causes pg to execute a command as soon as you
enter the command letter in response to the prompt (see COMMANDS
DURING A PG SESSION). With commands which do not include a
letter, you press the space bar or <RETURN>.
-n not specified:
Every command must be terminated with <RETURN>.
-r Restricted mode. Shell commands are not permitted. If a shell com-
mand is entered, pg issues an error message but does not terminate.
-s Displays all messages and prompts in "standout" mode, which is
usually inverse video.
+number
Starts displaying the file at a specified line number.
number
Line number at which the output is to begin.
+/RE/
Starts the output at the first line containing a string matching
regular expression RE. RE is any simple regular expression (see
expressions(5), "Regular expressions").
This option is not effective unless the file is more than one
page long (see -number above).
You can also search for strings interactively during a pg session
(see Pattern search commands).
-- End of the list of options. Must be specified if file begins with
-.
filename
Name of the file to be paged. You can name more than one file, in
which case pg displays the following before each file:
(Next file: filename).
If you use a dash (-) as filename, pg reads from standard input.
The commands n and p can be used to switch between various files
during a session with pg (see Miscellaneous commands).
filename not specified:
pg reads from standard input (see COMMANDS DURING A PG SESSION).
Commands to pg are entered after the prompt on the last line and
must normally be terminated by pressing the <RETURN>. You may,
however, set the -n option and have them executed immediately.
Page 3 Reliant UNIX 5.44 Printed 11/98
pg(1) pg(1)
During a session, pg may be in one of two states: displaying a page or
waiting for the input of a command. The effect of pressing <DEL> or
<CTRL-\> depends on the state pg is in:
- pg exits if it was in command mode, i.e. waiting for the input of a
command.
- In visual mode, pg interrupts the display and issues its prompt,
allowing you to enter new commands.
If you are using pg as a command in a pipeline, striking <DEL> or
<CTRL-\> will affect other commands in the pipeline as well.
Let us assume that a grep command is writing to a pipe from which pg
is reading input. If you press <DEL> while pg is displaying a page,
grep will terminate, not pg; all data sent to the pipe by grep prior
to its termination will still be read by pg.
Paging commands
<RETURN>
<SPACE>
On its own, scrolls to the next page.
number
pg scrolls to the page addressed by number, relative to the
beginning of the file. Thus it makes no difference whether the
specified page comes before or after the current page.
+[number]
Causes pg to scroll forward relative to the current page.
number Number of pages to move forward; the farthest you can
page forward is the last page of the file.
number not specified:
pg scrolls forward one page.
-[number]
Causes pg to scroll backward relative to the current page.
number Number of pages to be scrolled back. The farthest you
can page back is the first page of the file.
number not specified:
pg scrolls back one page.
[number]l
Causes pg to interpret the specified number as an absolute line
address.
Page 4 Reliant UNIX 5.44 Printed 11/98
pg(1) pg(1)
number pg scrolls to the page addressed by number, relative to
the beginning of the file. It makes no difference
whether this line comes before or after the current
line.
number not specified:
pg scrolls forward by one line.
+[number]l
Causes pg to scroll forward by the specified number of lines.
number Number of lines by which pg is to scroll forward.
number not specified:
pg scrolls forward one line.
-[number]l
Causes pg to scroll back by the specified number of lines.
number Number of lines by which pg is to scroll backward.
number not specified:
pg scrolls back one line.
[+]d
[+]<CTRL-D>
Scrolls half a screen forward. Use of the preceding plus sign +
is optional.
-d
-<CTRL-D>
Scrolls half a screen back.
numberf
Skips number screens of text.
numberz
Same as <RETURN>. If specified, number becomes the new default
number of lines per screenful.
.
<CTRL-L>
Causes the current page to be redisplayed.
$ pg displays the last page of the current file. $ should be used
with caution when the input is read from a pipe.
Page 5 Reliant UNIX 5.44 Printed 11/98
pg(1) pg(1)
Pattern search commands
[k]/RE/[place]
Searches forward for strings that match the specified RE,
displaying the location at which the string appears.
The search begins with the page that comes immediately after the
current page. If no matching string is found, the search ter-
minates at the end of the current file.
k Causes pg to search for the kth occurrence of a matching
string.
k not specified:
pg starts the output with the first matching string found.
RE A regular expression that defines the string to be located.
RE must be a simple regular expression (see expressions(5),
"Regular expressions").
place
Location at which the matching string is to be displayed on
the screen. You can enter:
m to place the line containing the matching string in the
middle of the screen;
b to place the line with the matching string at the bot-
tom of the screen;
t to place the line with the matching string at the top
of the screen.
place not specified:
The line with the matching string is placed at the top of
the screen.
[k]?RE?[place]
[k]^RE^[place]
Searches backward for strings that match the specified RE,
displaying the location at which the string appears.
The search begins with the page that immediately precedes the
current page. If no matching string is found, the search ter-
minates at the beginning of the current file.
k Causes pg to search for the kth occurrence of a matching
string.
Page 6 Reliant UNIX 5.44 Printed 11/98
pg(1) pg(1)
k not specified:
pg starts the output with the first matching string found.
RE A regular expression that defines the string to be located.
RE must be a simple internationalized regular expression
(see expressions(5), "Regular expressions").
place
Location at which the matching string is to be displayed on
the screen. You can enter:
m to place the line containing the matching string in the
middle of the screen;
b to place the line with the matching string at the bot-
tom of the screen;
t to place the line with the matching string at the top
of the screen.
place not specified:
The line with the matching string is placed at the top of
the screen.
Miscellaneous commands
h Help function; displays a summary of available commands.
[i]n Goes to the ith next file named on the pg command line, making
this file the current file. If there is not a sufficient number
of files available, the last file becomes the current file.
i not specified:
The next file named on the command line becomes the current file.
[i]p Goes to the ith previous file named on the pg command line, mak-
ing this file the current file. If there is not a sufficient
number of files available, the first file becomes the current
file.
i not specified:
The previous file named on the command line becomes the current
file.
iw Sets the window size to i lines.
The default window size is 23 lines. You can also modify this
setting when you call pg (see -number above).
Page 7 Reliant UNIX 5.44 Printed 11/98
pg(1) pg(1)
sfilename
Saves the current file under the specified filename.
!command
Passes the named command to the command interpreter named in the
SHELL environment variable. If this variable is not defined, the
default command interpreter is used.
This command must always be terminated with the <RETURN> key,
even if you have invoked pg with the -n option.
q
Q Quits the pg command. You can also quit pg by pressing <RETURN>
at the end of the last file named on the command line.
ENVIRONMENT VARIABLES
COLUMNS
Defines the number of columns for the screen. This value takes
precedence over the number of columns defined for the TERM vari-
able.
LINES
Defines the number of lines for the screen. This value takes pre-
cedence over the number of lines defined for the TERM variable.
SHELL
This environment variable determines the command interpreter to
which pg passes shell commands entered during a pg session (see
the ! command).
TERM Type of terminal on which pg is executed.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed.
LCCOLLATE governs the collating sequence.
LCTYPE governs character classes and character conversion (shifting).
If LCMESSAGES, LCCOLLATE or LCCTYPE is undefined or is defined as
the null string, it defaults to the value of LANG. If LANG is likewise
undefined or null, the system acts as if it were not international-
ized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
If any of the locale variables has an invalid value, the system acts
as if none of the variables were set.
Page 8 Reliant UNIX 5.44 Printed 11/98
pg(1) pg(1)
EXAMPLES
Locate the first occurrence of the word example in the file text:
$ pg +/example/ text
SEE ALSO
cat(1), ed(1), grep(1), more(1), terminfo(4), expressions(5).
Page 9 Reliant UNIX 5.44 Printed 11/98