Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Apropos / Subsearch:
optional field

pg(1)									pg(1)


  pg - Formats files for a terminal display


  pg [-cefns] [-p string] [+line_number	| +/pattern/] [-number]	[file...]

  The pg command reads the specified file or files (or standard	input by
  default) and writes them to standard output one screen at a time.  At	the
  end of each screen you can display the next screen or	enter various subcom-
  mands, including those that let you back up to review	something that has
  already passed.


  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  pg:  XCU5.0

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.


  -c  Moves the	cursor to the home position and	clears the is not defined for
      your terminal type in the	terminfo file.

  -e  Does not pause at	the end	of each	file.  However,	pg still pauses	at
      the beginning of each file.

  -f  Does not split lines.  Normally, pg splits (wraps) lines longer than
      the screen width.

  -n  Stops processing when a pg command letter	is entered.  Normally, com-
      mands must end with a newline character.

  -p string
      Uses string as the prompt.  If the string	contains %d, %d	is replaced
      by the current page number in the	prompt.	 The default prompt is :
      (colon).	If string contains spaces, you must quote it.  In addition,
      if string	contains either	the <&lt; or >&gt; characters, you must	quote it;
      otherwise, these characters are treated as shell redirection commands.

  -s  Highlights all messages and prompts.

      Starts at	line_number.

      Specifies	the number of lines in the window.

      Starts at	the first line that contains pattern.


      The name of a file to be read and	displayed.  If you specify file	as a
      -	(dash) or run pg without arguments, pg reads standard input.


  To determine terminal	attributes, pg looks up	the terminal type specified
  by the TERM environment variable in the terminfo database.  The default
  type is dumb.

  At any time during the operation of pg, you can enter	the Quit (usually
  <&lt;Ctrl-\>&gt; ) or	Interrupt (usually <&lt;Ctrl-c>&gt;) key sequences.  If	pg is sending
  output, it interrupts	output and displays the	prompt,	and you	can then
  enter	one of the subcommands in the normal manner.  If the prompt is
  already displayed, the Quit and Interrupt sequences terminate	pg.  (Note
  that on a high-speed display it may be difficult to enter a Quit or Inter-
  rupt between prompts,	because	the interval between them is so	short.)

  Note that some output	is lost	when you use the Quit or Interrupt sequences
  during output	because	any characters waiting in the output queue are purged
  when the QUIT	or INTERRUPT signal is received.  When you use pg in a pipe,
  an Interrupt is likely to end	the other commands in the pipe.

  If standard output is	not a terminal,	pg acts	like the cat command, writing
  the input to standard	output without any formatting or special treatment,
  except that a	header is displayed before each	file.

  If terminal tabs are not set for every eight positions, unpredictable
  results can occur.


  The pg utility is marked LEGACY in XCU Issue 5.


  When pg pauses and displays its prompt, you can enter	a subcommand.  Some
  of these subcommands change the display to a particular place	in the file,
  some search for specific patterns in the text, and others change the
  environment in which pg works.

  Location Subcommands

  The following	commands display a selected place in the file:

      Displays page number number.

      Displays the page	number pages after the current page.

      Displays the page	number pages before the	current	page.

  l   Scrolls the display one line forward.

      [Tru64 UNIX]  Displays a screen with the specified line number at	the

      Scrolls the display number lines forward.

      Scrolls the display number lines backward.

  d   Scrolls half a screen forward.  Pressing <&lt;Ctrl-d>&gt;	(and <&lt;Return>&gt; if you
      have not specified -n) has the same effect.

  -d  Scrolls half a screen backward.  Pressing	- and then <&lt;Ctrl-d>&gt; (and
      <&lt;Return>&gt; if you have not specified -n) has the same effect.

      [Tru64 UNIX]  Skips number screens forward.

      [Tru64 UNIX]  Skips number screens backward.

      Displays the current page	again.	A single . (dot) also does this.

  $   Displays the last	page in	the file.  Do not use this when	the input is
      from a pipeline.

  Search Subcommands

  The following	commands search	for patterns in	the text.  You can use the
  regular expressions described	in grep. They must always end with a newline
  character, even if the -n option is used.  In	an expression such as [a-z],
  the dash means through according to the current collating sequence.  The
  collating sequence is	determined by the value	of the LC_COLLATE environment

      Searches for the number'th occurrence of pattern.	 The search begins
      immediately after	the current page and continues to the end of the
      current file, without wrapping around. The default for number is 1.


      Searches backward	for the	number'th occurrence of	pattern.  The search
      begins immediately before	the current page and continues to the begin-
      ning of the current file,	without	wraparound.  The ^ (circumflex)	is
      useful for the Adds 100 terminal,	which cannot handle a ?	(question
      mark).  The default for number 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.

  Environment Subcommands

  You can change the pg	environment with the following subcommands:

      Begins examining the number'th next file in the command line.  The
      default number is	1.

      Begins examining the number'th previous file on the command line.	 The
      default number is	1.

      Sets the window size to number.  If number is not	present, displays
      another window of	text.

      Same as w.

  s file
      Saves the	input in file.	Only the current file being examined is
      saved.  This command must	always end with	a newline character, even if
      you specify the -n option.

  h   Displays an abbreviated summary of available subcommands.

  q or Q
      Quits pg.

      Sends the	specified command to the shell named in	the SHELL environment
      variable.	 If this is not	available, the default shell is	used.  This
      command must always end with a newline character,	even if	the -n option
      is used.


  The following	exit values are	returned:

  0   Successful completion.

  >&gt;0  An error occurred.


  To look at the contents of file file1	one page at a time, enter:

       pg file1


  The following	environment variables affect the execution of pg:

      Determines the horizontal	screen size.  If this variable is unset, TERM
      is used.

      Provides a default value for the internationalization variables that
      are unset	or null. If LANG is unset or null, the corresponding value
      from the default locale is used.	If any of the internationalization
      variables	contain	an invalid setting, the	utility	behaves	as if none of
      the variables had	been defined.

      If set to	a non-empty string value, overrides the	values of all the
      other internationalization variables.

      Determines the locale for	the interpretation of sequences	of bytes of
      text data	as characters (for example, single-byte	as opposed to multi-
      byte characters in arguments) and	the behavior of	character classes in
      regular expressions.

      Determines the locale for	the format and contents	of diagnostic mes-
      sages written to standard	error.

      Determines the number of lines to	be displayed on	the screen.  If	this
      variable is unset, TERM is used.

      Determines the location of message catalogues for	the processing of

      Determines the name of the command interpreter executed for a ! subcom-

      Determines the terminal attributes.


      Terminal capability database.

      Temporary	file used when input is	from a pipe.


  Commands:  cat(1), grep(1), more(1)

  Files:  locale(4) terminfo(4)

  Standards:  standards(5)