|HP-UX Reference > P
pg(1)HP-UX 11i Version 3: February 2007
pg — file perusal filter for soft-copy terminals
pg [- number] [-p string] [-cefnrs] [+ linenumber] [+/ pattern] [file ...]
pg and more are both used in similar situations (see more(1)). Text highlighting features supported by more are not available from pg. However, pg has some useful features not provided by more.
pg is a text file filter that allows the examination of files one screenful at a time on a soft-copy terminal. If - is used as a file argument, or pg detects NULL arguments in the comand line, the standard input is used. Each screenful is followed by a prompt. To display a new page, press Return. Other possibilities are enumerated below.
This command is different from other paginators such as more in that it can back up for reviewing something that has already passed. The method for doing this is explained below.
In order to determine terminal attributes, pg scans the terminfo data base for the terminal type specified by the environment variable TERM (see terminfo(4)). If TERM is not defined, terminal type dumb is assumed.
pg recognizes the following command line options:
pg looks in the environment variable PG to preset any flags desired. For example, if you prefer to view files using the -c mode of operation, the POSIX-shell command sequence PG='-c' ; export PG or the C-shell command setenv PG -c causes all invocations of pg, including invocations by programs such as man and msgs, to use this mode. The command sequence to set up the PG environment variable is normally placed in the user .profile or .cshrc file. No form of quoting is provided, so the string and pattern arguments are limited to single word.
The responses that can 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 that 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 either in pages or lines, depending on the command. A signed address specifies a point relative to the current page or line; 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.
Perusal commands and their defaults are as follows:
The following perusal commands take no address:
The following commands are available for searching for text patterns in the text. The Basic Regular Expression syntax (see regexp(5)) is supported. The terminal /, ^, or ? can be omitted from the pattern search commands. Regular expressions must always be terminated by a new-line character, even if the -n option is specified.
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.
pg users can modify the perusal environment with the following commands:
At any time when the output is being sent to the terminal, the user can press the quit key (normally CTRL-\), the interrupt (break) key or the DEL key. This causes pg to stop sending output, and display the prompt. The user may then enter one of the 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 terminal, pg is functionally equivalent to cat (see cat(1)), except that a header is printed before each file if more than one file is specified.
LC_COLLATE determines the collating sequence used in evaluating regular expressions.
LC_CTYPE determines the interpretation of text as single and/or multi-byte characters, and the characters matched by character class expressions in regular expressions.
LANG determines the language in which messages are displayed.
If LC_COLLATE or LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, pg behaves as if all internationalization variables are set to "C". See environ(5).
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 (such as crypt(1)), 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 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, because an interrupt is likely to terminate the other commands in the pipeline.
Users of more will find that the z and f commands are available, and that the terminal /, ^, or ? can be omitted from the pattern search commands.
crypt(1), grep(1), more(1), terminfo(4), environ(5), lang(5), regexp(5).