summaryrefslogtreecommitdiff
path: root/text-utils/pg.1
blob: 056be06cff90907ec578355b29d1d7e52129959d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
.\" @(#)pg.1	1.7 (gritter) 4/25/01
.TH PG 1 "2001-04-25" "Gunnar Ritter" "User Commands"
.SH NAME
pg \- browse pagewise through text files
.SH SYNOPSIS
.B pg
[
.I \-number
] [
.BI \-p \ string
] [
.B \-cefnrs
] [
.I +line
] [
.I +/pattern/
] [ file . . . ]
.SH DESCRIPTION
.I Pg
displays a text file on a
.SM CRT
one screenful at once.
After each page, a prompt is displayed. The user may then either press the
newline key to view the next page or one of the keys described below.
.PP
If no filename is given on the command line,
.I pg
reads from standard input.
If the standard output is not a terminal,
.I pg
acts like
.IR cat (1)
but precedes each file with its name if there is more than one.
.PP
If input comes from a pipe,
.I pg
stores the data in a buffer file while reading
to make navigation possible.
.SH OPTIONS
.I Pg
accepts the following options:
.TP
.BI \- number
The number of lines per page. Usually, this is the number of
.SM CRT
lines
minus one.
.TP
.B \-c
Clear the screen before a page is displayed
if the terminfo entry for the terminal provides this capability.
.TP
.B \-e
.I pg
will not pause and display 
.SM (EOF)
at the end of a file.
.TP
.B \-f
.I pg
does not split long lines.
.TP
.B \-n
Without this option, commands must be terminated by a newline character. With
this option,
.I pg
advances once a command letter is entered.
.TP
.BI \-p \ string
Instead of the prompt
.I " :"
,
.I string
is displayed.
If
.I string
contains
.I %d
, its first occurence is replaced by the number of the current page.
.TP
.B \-r
Disallow the shell escape.
.TP
.B \-s
Print messages in
.I standout
mode
if the terminfo entry for the terminal provides this capability.
.TP
.BI + number
Start at the given line.
.TP
.BI +/ pattern /
Start at the line containing the Basic Regular Expression
.I pattern
given.
.SH USAGE
The following commands may be entered at the prompt. Commands preceeded by
.I i
in this document accept a number as argument, positive or negative.
If this argument starts with
.I +
or
.I \-,
it is interpreted relative to the current position in the input file,
otherwise relative to the beginning.
.TP
.IB i <newline>
Display the next or the indicated page.
.TP
\fIi\fR\fBd\fR or \fB^D\fR
Display the next halfpage. If
.I i
is given, it is always interpreted relative to the current position.
.TP
.IB i l
Display the next or the indicated line.
.TP
.IB i f
Skip a page forward.
.I i
must be a positive number and is always interpreted relative
to the current position.
.TP
\fIi\fR\fBw\fR or \fIi\fR\fBz\fR
Behave as
.I <newline>
except that 
.I i
becomes the new page size.
.TP
.BR . " or " ^L
Redraw the screen.
.TP
.B $
Advance to the last line of the input file.
.TP
.IB i / pattern /
Search forward until the first or the \fIi\fR-th
occurence of the Basic Regular Expression 
.I pattern
is found. The search starts
after the current page and stops at the end of the file. No wrap-around is
performed.
.I i
must be a positive number.
.TP
\fIi\fR\fB?\fR\fIpattern\fR\fB?\fR or \fIi\fR\fB^\fR\fIpattern\fR\fB^\fR
Search backward until the first or the \fIi\fR-th
occurence of the Basic Regular Expression
.I pattern
is found. The search starts
before the current page and stops at the beginning of the file.
No wrap-around is performed. 
.I i
must be a positive number.
.PP
The search commands accept an added letter. If
.B t
is given, the line containing the pattern is displayed at the top of the
screen, which is the default.
.B m
selects the middle and
.B b
the bottom of the screen.
The selected position is used in following searches, too.
.TP
.IB i n
Advance to the next file or
.I i
files forward.
.TP
.IB i p
Reread the previous file or
.I i
files backward.
.TP
.BI s \ filename
Save the current file to the given
.I filename.
.TP
.B h
Display a command summary.
.TP
.BI ! command
Execute
.I command
using the shell.
.TP
.BR q " or " Q
Quit.
.PP
If the user presses the interrupt or quit key while
.I pg
reads from the
input file or writes on the terminal,
.I pg
will immediately display the prompt.
In all other situations these keys will terminate
.I pg.
.SH "ENVIRONMENT VARIABLES"
The following environment variables
affect the behaviour of
.I pg:
.TP
.B COLUMNS
Overrides the system-supplied number of columns if set.
.TP
.BR LANG ,\  LC_ALL ,\  LC_COLLATE ,\  LC_CTYPE ,\  LC_MESSAGES
See
.IR locale (7).
.TP
.B LINES
Overrides the system-supplied number of lines if set.
.TP
.B SHELL
Used by the
.B !
command.
.TP
.B TERM
Determines the terminal type.
.SH "SEE ALSO"
.BR cat (1),
.BR more (1),
.BR sh (1),
.BR terminfo (5),
.BR locale (7),
.BR regex (7),
.BR term (7)
.SH NOTES
.I pg
expects the terminal tabulators to set on eight positions.
.PP
Files that include
.SM NUL
characters cannot be displayed by
.IR pg .