Module 103 pg (SV)

Previous Table of Contents Next


Module 103
pg (SV)

DESCRIPTION

The external pg command is used to examine a file one screen at a time. It functions as an enhanced cat command or a stripped down view command, providing functionality somewhere in between. The pg paginator allows you to:

   Peruse the standard input or multiple files.
   Page forward or backward multiple pages.
   Search forward or backward for a regular expression or string.
   Scroll forward or backward by lines.
   Goto specific lines.
   Redisplay the current page.
   Move forward or backward to different files.
   Save the current file to a new file.
   Display a built-in help screen.
   Use options to change its functionality.

COMMAND FORMAT

Following is the general format of the pg command.

 pg [ - ] [ -cefnrs ] [ -n ] [ -p prompt ] [ +line ] [ +/pattern/ ] \ file_list 

Options

The following list describes the options and their arguments used to control how pg functions.

- Forces pg to read from the standard input.
-c Home the cursor and clear the screen before displaying each screen. Each page is displayed on a clear screen instead of scrolling the lines. The TERM variable must be defined. The TERMinal type must have clear screen capabilities defined in the TERMCAP or TERMINFO database.
-e Don t prompt for a response at the end of each file. Normally pg prompts you at the end-of-file.
-f Inhibits line splitting. If a line is longer than the screen width, pg normally splits the line. For instance, if the line has many escape sequences to control terminal attributes, pg will split the line and it will appear incorrect. The -f option is useful when characters that don t appear on the display are embedded in the file.
-n Does not require a new-line character to process a command. Single-letter commands are interpreted and processed immediately.
-r Restrict shell escape from pg . An error message is displayed if an attempt is made to escape to the shell.
-s Turns on standout mode causing pg to display its prompts and messages in standout mode. Usually, this is reverse video. The TERMCAP or TERMINFO entry for the specified TERMinal defines what standout mode is on your terminal.
- n Specifies the number of lines pg uses for the screen window. If the terminal is defined to have a 24-line screen, the window is set to 23 lines.
-p prompt Changes the prompt displayed by pg to be prompt . Normally, a colon (:) is displayed. If %d is placed in the prompt string, the current page number is substituted.
+ line Begin displaying the file at line number line .
+/ pattern / Begin displaying the file at the first occurrence of pattern . Pattern may be a string or a regular expression.

Arguments

The following describes the argument that may be passed to the pg command.

file_list One or more files pg reads and displays on your terminal screen. pg prompts you between each file unless the -e option is used.

FURTHER DISCUSSION

After each screen is displayed pg prompts you for a response. There are three basic types of responses:

   Press Return to display the next screen.
   Press Del to terminate displaying the current file. If the current file is the last file then pg terminates. Otherwise, the next file is displayed.
   Enter a command described in the following COMMANDS section.

The pg command needs to know the attributes for your terminal. It searches the TERMCAP or TERMINFO database for the terminal defined by the TERM variable. If TERM is not set, pg assumes you are on a dumb terminal.

COMMANDS

At the end of each screen pg prompts for a response. To continue you must enter one of the following commands at the prompt. The commands are separated into four categories:

   Perusal commands that provide scrolling and positioning within the current file.
   Search commands that allow you to search for a desired pattern.
   Environment commands that let you control how pg functions.
   Miscellaneous commands to quit, get help, save current file, or escape to a subshell.

Perusal Commands

These commands let you move around the current file ( line-by-line motion only) and peruse the data. An address may be placed before these commands except for the Redisplay (. or Ctrl-L) and Last Screen ($) commands.

The address affects pages or lines depending on the command. Using these commands you can move to an absolute address or a relative address. An absolute address is measured from the beginning of the file. A relative address is measured from your current position within the file.


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net