Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pg(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ed

grep

terminfo

pg

PURPOSE

     Formats files to the work station.

SYNOPSIS
     pg [-number] [-p string] [-cefns] [+linenumber] [+/pattern/]
     [ files ... ]


DESCRIPTION

     The pg  command reads files  and writes them  to standard
     output one  screen at a time.   If you specify file  as -
     (minus) or  run pg  without arguments, pg  reads standard
     input.   Each screen  is followed  by a  prompt.  If  you
     press the Enter  key, another page is  displayed.  The pg
     command lets  you back  up to  review something  that has
     already passed.

     To determine  work station attributes, pg  scans the file
     terminfo for the work station type specified by the envi-
     ronment variable  TERM.  The  default type is  dumb.  See
     AIX Operating System  Technical Reference for information
     on terminfo.

SUBCOMMANDS

     When pg  pauses and  issues its prompt,  you can  issue a
     subcommand.  Some of these subcommands change the display
     to a particular  place in the file, some  search for spe-
     cific patterns in  the text, and others  change the envi-
     ronment in which pg works.

     The following  commands display  a selected place  in the
     file:

     page            Displays the specified page.
     +num            Displays  the page  num  pages after  the
                     current page.
     -num            Displays  the page  num pages  before the
                     current page.
     l               Scrolls the display one line forward.
     numl            Displays a screen with the specified line
                     number at the top.
     +numl           Scrolls the display num lines forward.
     -numl           Scrolls the display num lines backward.
     d               Scrolls half a  screen forward.  Pressing
                     Ctrl-D also does this.
     -d              Scrolls half a screen backward.  Pressing
                     -Ctrl-D also does this.

     Ctrl-L          Displays  the  current   page  again.   A
                     single period also does this.
     $               Displays the  last page in the  file.  Do
                     not  use this  when the  input is  from a
                     pipeline.

     The following  commands search  for text patterns  in the
     text.  You can use the  patterns described in "ed."  They
     must always end with a new line character, even if the -n
     flag is used.  In an  expression such as [a-z], the minus
     means  "through"  according   to  the  current  collating
     sequence.   A collating  sequence may  define equivalence
     classes for  use in character ranges.   See the "Overview
     of International  Character Support" in Managing  the AIX
     Operating  System  for   more  information  on  collating
     sequences and equivalence classes.

     [num]/pattern/  Search  for   the  numth   occurrence  of
                     pattern.   The search  begins immediately
                     after the  current page and  continues to
                     the end of the current file, without wrap
                     around.  The default for num is 1.
     num?pattern?
     num^pattern^    Search backward for  the numth occurrence
                     of pattern.   The searching  begins imme-
                     diately before the  current page and con-
                     tinues  to the  beginning of  the current
                     file,   without  wrap   around.   The   ^
                     (circumflex) is  useful for the  Adds 100
                     work station, which  cannot handle the ?.
                     The default for num is 1.

     After searching,  pg normally displays the  line found at
     the top of  the screen.  You can change this  by adding m
     or b to the search command to leave the line found in the
     middle or at the bottom of the window with all succeeding
     subcommands.  Use  the suffix  t to return  to displaying
     the line with the pattern to the top of the screen.

     You can change the pg environment with the following sub-
     commands:

     [num]n          Begins examining  the numth next  file in
                     the command line.  The default num is 1.
     [num]p          Begins examining the  numth previous file
                     on the command line.   The default num is
                     1.
     [num]w          Displays another window  of text.  If num
                     is present, sets the window size to num.
     s  file         Saves  the  input   in  file.   Only  the
                     current  file  being examined  is  saved.
                     This command  must always end with  a new
                     line character,  even if you  specify the
                     -n flag.
     h               Displays an abbreviated summary of avail-
                     able subcommands.
     q or Q          Quits pg.
     !AIX-cmd        Sends  the specified  AIX command  to the
                     shell named in the SHELL environment var-
                     iable.   If this  is  not available,  the

                     default shell is used.  This command must
                     always  end with  a  new line  character,
                     even if the -n flag is used.

     At  any  time when  output  is  being  sent to  the  work
     station, you can press QUIT  WITH DUMP (Ctrl-V) or INTER-
     RUPT (Alt-Pause).  This causes  pg to stop sending output
     and displays the  prompt.  Then you can enter  one of the
     above commands in the normal manner.

     Note: Some output is  lost when when you  press QUIT WITH
     DUMP (Ctrl-V) or INTERRUPT  (Alt-Pause) because any char-
     acters waiting  in the output  queue are purged  when the
     QUIT signal is received.

     If standard  output is not  a work station, pg  acts like
     the  cat command,  except that  a header  displays before
     each file.

     While waiting  for work  station input, pg  stops running
     when  you press  INTERRUPT (Alt-Pause).   Between prompts
     these signals interrupt the current task and place you in
     the prompt mode.

     Notes:

     1.  When you use pg in a  pipe, an Interrupt is likely to
         end the other commands in the pipe.

     2.  If work  station tabs are  not set every  eight posi-
         tions, unpredictable results can occur.

     3.  When  using pg  in a  pipe with  other commands  that
         change work  station I/O  options, work  station set-
         tings may not be restored correctly.

FLAGS

     -c          Moves  the cursor  to the  home position  and
                 clears  the screen  before  each page.   This
                 flag  is  ignored   if  clear_screen  is  not
                 defined  for your  work station  type in  the
                 terminfo file.
     -e          Does not pause at the end of each file.
     -f          Does  not split  lines.  Normally,  pg splits
                 lines longer than the screen width.
     -n          Stops processing when a  pg command letter is
                 entered.  Normally, commands  must end with a
                 new-line character.
     -p  string  Uses  string as  the prompt.   If the  string
                 contains  a %d,  the  %d is  replaced by  the
                 current  page  number  in  the  prompt.   The
                 default prompt is :  (colon).  If string con-
                 tains spaces, you must quote it.
     -s          Highlights all messages and prompts.
     +linenum    Starts at linenum.
     -num        Specifies the number of  lines in the window.
                 On work  stations that contain 24  lines, the
                 default is 23.

     +/pattern/  Starts  at  the   first  line  that  contains
                 pattern.

FILES

     /usr/lib/terminfo/*
     /tmp/pg*

RELATED INFORMATION

     The following commands:  "ed" and "grep."

     The terminfo file in  AIX Operating System Technical Ref-
     erence.

     The "Overview of International Character Support" in Man-
     aging the AIX Operating System.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026