1pg(1)                            User Commands                           pg(1)
2
3
4

NAME

6       pg - files perusal filter for CRTs
7

SYNOPSIS

9       pg [-number] [-p string] [-cefnrs] [+ linenumber]
10            [+/ pattern /] [filename]...
11
12

DESCRIPTION

14       The pg command is a filter that allows the examination of filenames one
15       screenful at a time on a CRT. If the user types a RETURN, another  page
16       is displayed; other possibilities are listed below.
17
18
19       This  command  is  different from previous paginators in that it allows
20       you to back up and review something that has already passed. The method
21       for doing this is explained below.
22
23
24       To  determine  terminal  attributes, pg scans the terminfo(4) data base
25       for the terminal type specified by the environment  variable  TERM.  If
26       TERM is not defined, the terminal type dumb is assumed.
27

OPTIONS

29       -number        An  integer specifying the size (in lines) of the window
30                      that pg is to use instead of the default. (On a terminal
31                      containing 24 lines, the default window size is 23).
32
33
34       -pstring       pg  uses string as the prompt. If the prompt string con‐
35                      tains a %d, the first occurrence of  %d  in  the  prompt
36                      will  be  replaced  by  the current page number when the
37                      prompt is issued. The default prompt string is ``:''.
38
39
40       -c             Home the cursor and clear the screen  before  displaying
41                      each page. This option is ignored if clear_screen is not
42                      defined for this terminal type in the  terminfo(4)  data
43                      base.
44
45
46       -e             pg does not pause at the end of each file.
47
48
49       -f             Normally,  pg splits lines longer than the screen width,
50                      but some sequences of characters in the text being  dis‐
51                      played  (for instance, escape sequences for underlining)
52                      generate undesirable results. The -f option inhibits  pg
53                      from splitting lines.
54
55
56       -n             Normally,  commands  must  be  terminated by a <newline>
57                      character. This option causes an automatic end  of  com‐
58                      mand as soon as a command letter is entered.
59
60
61       -r             Restricted  mode.  The  shell  escape  is disallowed. pg
62                      prints an error message but does not exit.
63
64
65       -s             pg prints all messages and prompts in the standard  out‐
66                      put mode (usually inverse video).
67
68
69       +linenumber    Start up at linenumber.
70
71
72       +/pattern/     Start  up  at  the  first  line  containing  the regular
73                      expression pattern.
74
75

OPERANDS

77       The following operands are supported:
78
79       filename    A path name of a text file to be displayed. If no  filename
80                   is given, or if it is −, the standard input is read.
81
82

USAGE

84   Commands
85       The  responses  that  may  be  typed when pg pauses can be divided into
86       three categories: those causing further perusal, those that search, and
87       those that modify the perusal environment.
88
89
90       Commands  that cause further perusal normally take a preceding address,
91       an optionally signed number indicating the  point  from  which  further
92       text  should  be displayed. This address is interpreted in either pages
93       or lines depending on the command. A signed address specifies  a  point
94       relative to the current page or line, and an unsigned address specifies
95       an address relative to the beginning of the file. Each  command  has  a
96       default address that is used if none is provided.
97
98
99       The perusal commands and their defaults are as follows:
100
101       (+1)<newline> or <blank>    This  causes  one page to be displayed. The
102                                   address is specified in pages.
103
104
105       (+1) l                      With a relative address this causes  pg  to
106                                   simulate  scrolling  the screen, forward or
107                                   backward, the number  of  lines  specified.
108                                   With   an  absolute  address  this  command
109                                   prints a screenful beginning at the  speci‐
110                                   fied line.
111
112
113       (+1) d or ^D                Simulates  scrolling  half a screen forward
114                                   or backward.
115
116
117       if                          Skip i screens of text.
118
119
120       iz                          Same  as  <newline>  except  that   i,   if
121                                   present,  becomes the new default number of
122                                   lines per screenful.
123
124
125
126       The following perusal commands take no address.
127
128       . or ^L      Typing a single period causes the current page of text  to
129                    be redisplayed.
130
131
132       $            Displays  the  last full window in the file. Use with cau‐
133                    tion when the input is a pipe.
134
135
136
137       The following commands are available for searching for text patterns in
138       the  text. The regular expressions are described on the regex(5) manual
139       page. They must always be terminated by a <newline>,  even  if  the  -n
140       option is specified.
141
142       i/pattern/    Search  forward  for  the ith (default i=1) occurrence of
143                     pattern. Searching begins immediately after  the  current
144                     page  and continues to the end of the current file, with‐
145                     out wrap-around.
146
147
148       i^pattern^
149
150
151       i?pattern?    Search backwards for the ith (default i=1) occurrence  of
152                     pattern.  Searching begins immediately before the current
153                     page and continues to the beginning of the current  file,
154                     without  wrap-around.  The  ^ notation is useful for Adds
155                     100 terminals which will not properly handle the ?.
156
157
158
159       After searching, pg will normally display the line found at the top  of
160       the screen. This can be modified by appending m or b to the search com‐
161       mand to leave the line found in the middle or at the bottom of the win‐
162       dow from now on. The suffix t can be used to restore the original situ‐
163       ation.
164
165
166       The user of pg can modify the environment of perusal with the following
167       commands:
168
169       in            Begin perusing the ith next file in the command line. The
170                     i is an unsigned number, default value is 1.
171
172
173       ip            Begin perusing the ith previous file in the command line.
174                     i is an unsigned number, default is 1.
175
176
177       iw            Display  another window of text. If i is present, set the
178                     window size to i.
179
180
181       s filename    Save the input in the named file. Only the  current  file
182                     being perused is saved. The white space between the s and
183                     filename is optional. This command must always be  termi‐
184                     nated by a <newline>, even if the -n option is specified.
185
186
187       h             Help  by  displaying  an abbreviated summary of available
188                     commands.
189
190
191       q or Q        Quit pg.
192
193
194       !command      Command is passed to the shell, whose name is taken  from
195                     the SHELL environment variable. If this is not available,
196                     the default shell is used. This command  must  always  be
197                     terminated by a <newline>, even if the -n option is spec‐
198                     ified.
199
200
201
202       At any time when output is being sent to the terminal, the user can hit
203       the  quit  key  (normally  CTRL-\)  or  the interrupt (break) key. This
204       causes pg to stop sending output, and display the prompt. The user  may
205       then  enter  one  of  the above commands in the normal manner. Unfortu‐
206       nately, some output is lost when this is done, because  any  characters
207       waiting in the terminal's output queue are flushed when the quit signal
208       occurs.
209
210
211       If the standard output is not  a  terminal,  then  pg  acts  just  like
212       cat(1),  except  that a header is printed before each file (if there is
213       more than one).
214
215   Large File Behavior
216       See largefile(5) for the description of the behavior of pg when encoun‐
217       tering files greater than or equal to 2 Gbyte ( 2^31 bytes).
218

EXAMPLES

220       Example 1 An example of the pg command.
221
222
223       The following command line uses pg to read the system news:
224
225
226
227       example% news | pg -p "(Page %d):"
228
229

ENVIRONMENT VARIABLES

231       See  environ(5) for descriptions of the following environment variables
232       that affect the execution of pg: LC_CTYPE, LC_MESSAGES, and NLSPATH.
233
234
235       The following environment variables affect the execution of pg:
236
237       COLUMNS    Determine the horizontal screen size. If unset or NULL,  use
238                  the  value of TERM, the window size, baud rate, or some com‐
239                  bination of these, to indicate the  terminal  type  for  the
240                  screen size calculation.
241
242
243       LINES      Determine the number of lines to be displayed on the screen.
244                  If unset or NULL, use the value of TERM,  the  window  size,
245                  baud  rate,  or  some  combination of these, to indicate the
246                  terminal type for the screen size calculation.
247
248
249       SHELL      Determine the name of the command interpreter executed for a
250                  !command.
251
252
253       TERM       Determine  terminal attributes. Optionally attempt to search
254                  a system-dependent database, keyed on the value of the  TERM
255                  environment variable. If no information is available, a ter‐
256                  minal incapable of cursor-addressable movement is assumed.
257
258

EXIT STATUS

260       The following exit values are returned:
261
262       0     Successful completion.
263
264
265       >0    An error occurred.
266
267

FILES

269       /tmp/pg*
270
271           temporary file when input is from a pipe
272
273
274       /usr/share/lib/terminfo/?/*
275
276           terminal information database
277
278

ATTRIBUTES

280       See attributes(5) for descriptions of the following attributes:
281
282
283
284
285       ┌───────────────────────────────────────────────────────────┐
286       │      ATTRIBUTE TYPE                ATTRIBUTE VALUE        │
287       │Availability                  SUNWcsu                      │
288       │CSI                           Enabled                      │
289       └───────────────────────────────────────────────────────────┘
290

SEE ALSO

292       cat(1),  grep(1),  more(1),  terminfo(4),  attributes(5),   environ(5),
293       largefile(5), regex(5)
294

NOTES

296       While  waiting  for  terminal  input, pg responds to BREAK, CTRL-C, and
297       CTRL−\ by terminating execution. Between prompts, however,  these  sig‐
298       nals  interrupt  pg's  current  task and place the user in prompt mode.
299       These should be used with caution when input is being read from a pipe,
300       since  an  interrupt  is  likely to terminate the other commands in the
301       pipeline.
302
303
304       The terminal /, ^, or ? may be omitted from the searching commands.
305
306
307       If terminal tabs are not set every eight positions, undesirable results
308       may occur.
309
310
311       When  using pg as a filter with another command that changes the termi‐
312       nal I/O options, terminal settings may not be restored correctly.
313
314
315
316SunOS 5.11                        25 Feb 1996                            pg(1)
Impressum