SYNOPSIS
pg [
DESCRIPTION
pg displays input files or piped output from another
command, a screenful at a time.
If you do not specify any files, the standard input is read.
Any file named
See the Commands section for commands that may be entered at page and file breaks. The following command line options globally control file perusal:
-c -
clears the screen before displaying each new window.
-e -
eliminates the (EOF): prompt at the end of each file.
-f -
does not insert a newline every COLUMNS characters. Normally, lines longer than the screen width, as given by the environment variable COLUMNS, are folded into multiple lines. On some systems, this folding is accomplished by inserting newlines (the MKS Toolkit version of pg does not do this). This option may be useful for files containing device-specific escape sequences.
-n -
executes interactive commands immediately upon receipt of the command character. This works for most commands (see Commands). Normally, all interactive commands must end in ENTER.
-p string-
sets the prompt string that appears at the end of each screenful of text to string. The default prompt is a colon (:). If string contains the characters %d, pg replaces those characters with the current page number as in [Page %d].
-s -
displays all interactive command prompts in standout mode (most often reverse video) on the screen.
-t -
does not save input in a temporary file. Normally, if any of the inputs is not directly seekable (as is the case for a serial device or pipe), pg reads input and saves it in a temporary file so that it can be reviewed. Because of this, you cannot scan backwards when viewing such input. This option is also recommended when reading a larger amount of data from a stream that cannot be accommodated on disk.
- screen-
sets the number of lines displayed in each screen to n lines. When this option is not present, the number of lines displayed is one less than the number of lines on the screen as given by the environment variable LINES. See also the w command in the Commands section.
+ line-
starts printing at line n of the first file. The default is to start printing at line 1.
+ /pattern/-
starts printing at the line containing the first occurrence of the extended regular expression pattern, as described in regexp.
Commands
Depending upon the options you specify, pg pauses between windows (screenfuls) of text, at the end of each file and before starting any file after than the first. At these pauses, pg prompts you to enter a command. To read the file, type the command ENTER (newline or Return) at each prompt.
An optional sign (+ or -) followed by an optional numeric address may precede the following commands. Addresses work in multiples of screen displays: for example, an address of +2 displays the second next screenful. Normally, an unsigned address implies direct addressing (measured from the beginning of the file). A signed address implies relative addressing in the file; a command beginning with a + scans forward and one beginning with a - scans backward from the current position.
You can edit commands interactively with the standard erase and kill characters.
These are the interactive commands:
- h
-
prints a summary of the interactive commands.
- q
- Q
-
exits immediately from pg.
- !command
-
executes the string command as if it were typed to the default command interpreter (as in ed). Whether or not you specified the
-n option, you must terminate this command with a newline. - [[±]n] ENTER
- [[±]n] SPACEBAR
-
without a specified address, displays the next window of text. With an address, displays the nth next window of text.
- [[±]n] d
- [[±]n] CTRL-d
-
scrolls a half screenful of text. The address is measured in half screenfuls and defaults to the next half screenful.
- [[±]n] l
-
with no address, displays the next line of the file. With an address, it displays a screenful starting at the addressed line.
- $
-
displays the last screenful of text in the file.
- CTRL-l
- .
-
redisplays the current displayed window of text.
- s file
-
saves the entire contents of the current file in file. Whether or not you specified the
-n option, you must terminate this command with a newline. - [n] n
-
displays the first screenful of the next file. The address (n) is actually the nth next file, counting from the current file. If present, n must be unsigned.
- [n] p
-
displays the first screenful of the previous file. The address (n) is actually the nth previous file, counting from the current file. If present, n must be unsigned.
- [n] w
-
scrolls another window of text. An argument, n, sets the window size to n and displays the next window of text. n must be unsigned.
- [i]/pattern/[tmb]
-
searches forward within the current file for the ith next occurrence of a line matching the regular expression pattern (default i is 1, the next matching pattern). The search starts right after the current window and continues to the end of the file. Normally the matching line is displayed at the top of the window, but this can be changed by an optional character at the end of the search command. The letter t is the default and displays the line at the top of the window; m displays it in the middle of the window; and b displays it in the bottom of the window. When no letter is present, pg uses the last letter entered (or t if no letter has been entered). Whether or not you specified the
-n option, you must terminate this command with a newline. - [i]?pattern?[tmb]
- [i]^pattern^[tmb]
-
is similar to the previous command, but searches backward instead of forward. The search starts just before the current window.
EXAMPLES
The following interactive commands illustrate the flexibility of pg. Suppose you have entered the command:
pg -n *.c
and that there are a large number of C source files in the current directory:
- 1
-
redisplays the first screenful of the current file.
- -4
-
goes back 4 windows in the current file and displays a screenful of text.
- p
-
displays the first screenful of the previous file.
- 10w
-
sets the screen size to 10 lines.
- /Fred/m
-
finds the first line containing Fred, searching forward from the current position in the file, and displays a screen with that line in the middle of the screen.
DIAGNOSTICS
Possible exit status values are:
FILES
- /tmp/pg*
-
Temporary files to allow backward reading. You can specify a temporary directory other than /tmp with the TMPDIR environment variable. For more information, see envvar.
ENVIRONMENT VARIABLES
- COLUMNS
-
contains the width of the screen in columns.
- LINES
-
contains the number of lines on the screen.
- ROOTDIR
-
contains the path name of PTC MKS Toolkit's root directory.
- TMPDIR
-
contains the path name of the directory where temporary files reside.
PORTABILITY
x/OPEN Portability Guide 4.0. UNIX System V.
The
On Windows systems, the erase character is BACKSPACE and the line kill character is ESC.
AVAILABILITY
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
PTC MKS Toolkit 10.5 Documentation Build 40.