Print this page
5801 nuke big file scanner (bfs)
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Albert Lee <trisk@omniti.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/ed.1
+++ new/usr/src/man/man1/ed.1
1 1 '\" te
2 2 .\" Copyright 1989 AT&T Copyright (c) 2003, Sun Microsystems, Inc. Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
3 3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 4 .\" http://www.opengroup.org/bookstore/.
5 5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 6 .\" This notice shall appear on any product containing this material.
7 7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 10 .TH ED 1 "Dec 10, 2003"
11 11 .SH NAME
12 12 ed, red \- text editor
13 13 .SH SYNOPSIS
14 14 .LP
15 15 .nf
16 16 \fB/usr/bin/ed\fR [\fB-s\fR | \fB-\fR] [\fB-p\fR \fIstring\fR] [\fB-x\fR] [\fB-C\fR] [\fIfile\fR]
17 17 .fi
18 18
19 19 .LP
20 20 .nf
21 21 \fB/usr/xpg4/bin/ed\fR [\fB-s\fR | \fB-\fR] [\fB-p\fR \fIstring\fR] [\fB-x\fR] [\fB-C\fR] [\fIfile\fR]
22 22 .fi
23 23
24 24 .LP
25 25 .nf
26 26 \fB/usr/xpg6/bin/ed\fR [\fB-s\fR | \fB-\fR] [\fB-p\fR \fIstring\fR] [\fB-x\fR] [\fB-C\fR] [\fIfile\fR]
27 27 .fi
28 28
29 29 .LP
30 30 .nf
31 31 \fB/usr/bin/red\fR [\fB-s\fR | \fB-\fR] [\fB-p\fR \fIstring\fR] [\fB-x\fR] [\fB-C\fR] [\fIfile\fR]
32 32 .fi
33 33
34 34 .SH DESCRIPTION
35 35 .sp
36 36 .LP
37 37 The \fBed\fR utility is the standard text editor. If \fIfile\fR is specified,
38 38 \fBed\fR simulates an \fBe\fR command (see below) on the named file. That is,
39 39 the file is read into \fBed\fR's buffer so that it can be edited.
40 40 .sp
41 41 .LP
42 42 The \fBed\fR utility operates on a copy of the file it is editing. Changes made
43 43 to the copy have no effect on the file until a \fBw\fR (write) command is
44 44 given. The copy of the text being edited resides in a temporary file called the
45 45 \fIbuffer\fR. There is only one buffer.
46 46 .sp
47 47 .LP
48 48 The \fBred\fR utility is a restricted version of \fBed\fR. It will only allow
49 49 editing of files in the current directory. \fBred\fR prohibits executing shell
50 50 commands via \fB!\fR\fIshell command\fR. Attempts to bypass these restrictions
51 51 result in an error message (\fIrestricted shell\fR).
52 52 .sp
53 53 .LP
54 54 Both \fBed\fR and \fBred\fR support the \fBfspec\fR(4) formatting capability.
55 55 The default terminal mode is either \fBstty\fR \fB-tabs\fR or \fBstty tab3\fR,
56 56 where tab stops are set at eight columns (see \fBstty\fR(1)). If, however, the
57 57 first line of \fIfile\fR contains a format specification, that specification
58 58 will override the default mode. For example, tab stops would be set at 5, 10,
59 59 and 15, and a maximum line length of 72 would be imposed if the first line of
60 60 \fIfile\fR contains
61 61 .sp
62 62 .in +2
63 63 .nf
64 64 \fB<:t5,10,15 s72:>\fR
65 65 .fi
66 66 .in -2
67 67 .sp
68 68
69 69 .sp
70 70 .LP
71 71 Commands to \fBed\fR have a simple and regular structure: zero, one, or two
72 72 \fIaddresses\fR followed by a single-character \fIcommand\fR, possibly followed
73 73 by parameters to that command. These addresses specify one or more lines in the
74 74 buffer. Every command that requires addresses has default addresses, so that
75 75 the addresses can very often be omitted.
76 76 .sp
77 77 .LP
78 78 In general, only one command may appear on a line. Certain commands allow the
79 79 input of text. This text is placed in the appropriate place in the buffer.
80 80 While \fBed\fR is accepting text, it is said to be in \fIinput mode\fR. In this
81 81 mode, \fBno\fR commands are recognized; all input is merely collected. Leave
82 82 input mode by typing a period (\fB\&.\fR) at the beginning of a line, followed
83 83 immediately by a carriage return.
84 84 .sp
85 85 .LP
86 86 If \fBed\fR executes commands with arguments, it uses the default shell
87 87 \fB/usr/bin/sh\fR (see \fBsh\fR(1)).
88 88 .SS "Regular Expressions"
89 89 .sp
90 90 .LP
91 91 The \fBed\fR utility supports a limited form of \fIregular expression\fR
92 92 notation. Regular expressions are used in addresses to specify lines and in
93 93 some commands (for example, \fBs\fR) to specify portions of a line that are to
94 94 be substituted. To understand addressing in \fBed\fR, it is necessary to know
95 95 that at any time there is a \fIcurrent line\fR. Generally speaking, the current
96 96 line is the last line affected by a command. The exact effect on the current
97 97 line is discussed under the description of each command.
98 98 .sp
99 99 .LP
100 100 Internationalized Basic Regular Expressions are used for all system-supplied
101 101 locales. See \fBregex\fR(5).
102 102 .SS "ed Commands"
103 103 .sp
104 104 .LP
105 105 Commands may require zero, one, or two addresses. Commands that require no
106 106 addresses regard the presence of an address as an error. Commands that accept
107 107 one or two addresses assume default addresses when an insufficient number of
108 108 addresses is given; if more addresses are given than such a command requires,
109 109 the last one(s) are used.
110 110 .sp
111 111 .LP
112 112 Typically, addresses are separated from each other by a comma (\fB,\fR). They
113 113 may also be separated by a semicolon (\fB;\fR). In the latter case, the first
114 114 address is calculated, the current line (\fB\&.\fR) is set to that value, and
115 115 then the second address is calculated. This feature can be used to determine
116 116 the starting line for forward and backward searches (see Rules 5 and 6, above).
117 117 The second address of any two-address sequence must correspond to a line in the
118 118 buffer that follows the line corresponding to the first address.
119 119 .sp
120 120 .LP
121 121 For \fB/usr/xpg6/gbin/ed\fR, the address can be omitted on either side of the
122 122 comma or semicolon separator, in which case the resulting address pairs are as
123 123 follows:
124 124 .sp
125 125
126 126 .sp
127 127 .TS
128 128 box;
129 129 c | c
130 130 l | l .
131 131 Specified Resulting
132 132 _
133 133 , 1 , $
134 134 _
135 135 , addr 1 , addr
136 136 _
137 137 addr , addr , addr
138 138 _
139 139 ; 1 ; $
140 140 _
141 141 ; addr 1 ; addr
142 142 _
143 143 addr ; addr ; addr
144 144 .TE
145 145
146 146 .sp
147 147 .LP
148 148 Any <\fIblank\fR>s included between addresses, address separators, or address
149 149 offsets are ignored.
150 150 .sp
151 151 .LP
152 152 In the following list of \fBed\fR commands, the parentheses shown prior to the
153 153 command are \fInot\fR part of the address. Rather, the parentheses show the
154 154 default address(es) for the command.
155 155 .sp
156 156 .LP
157 157 Each address component can be preceded by zero or more blank characters. The
158 158 command letter can be preceded by zero or more blank characters. If a suffix
159 159 letter (\fBl\fR, \fBn\fR, or \fBp\fR) is given, it must immediately follow the
160 160 command.
161 161 .sp
162 162 .LP
163 163 The \fBe\fR, \fBE\fR, \fBf\fR, \fBr\fR, and \fBw\fR commands take an optional
164 164 \fIfile\fR parameter, separated from the command letter by one or more blank
165 165 characters.
166 166 .sp
167 167 .LP
168 168 If changes have been made in the buffer since the last \fBw\fR command that
169 169 wrote the entire buffer, \fBed\fR warns the user if an attempt is made to
170 170 destroy the editor buffer via the \fBe\fR or \fBq\fR commands. The \fBed\fR
171 171 utility writes the string:
172 172 .sp
173 173 .in +2
174 174 .nf
175 175 "?\en"
176 176 .fi
177 177 .in -2
178 178 .sp
179 179
180 180 .sp
181 181 .LP
182 182 (followed by an explanatory message if \fIhelp mode\fR has been enabled via the
183 183 \fBH\fR command) to standard output and continues in command mode with the
184 184 current line number unchanged. If the \fBe\fR or \fBq\fR command is repeated
185 185 with no intervening command, \fBed\fR takes effect.
186 186 .sp
187 187 .LP
188 188 If an end-of-file is detected on standard input when a command is expected, the
189 189 \fBed\fR utility acts as if a \fBq\fR command had been entered.
190 190 .sp
191 191 .LP
192 192 It is generally illegal for more than one command to appear on a line. However,
193 193 any command (except \fBe\fR, \fBf\fR, \fBr\fR, or \fBw\fR) may be suffixed by
194 194 \fBl\fR, \fBn\fR, or \fBp\fR in which case the current line is either listed,
195 195 numbered or written, respectively, as discussed below under the \fBl\fR,
196 196 \fBn\fR, and \fBp\fR commands.
197 197 .sp
198 198 .ne 2
199 199 .na
200 200 \fB\fB(.)a\fR\fR
201 201 .ad
202 202 .br
203 203 .na
204 204 \fB<\fItext\fR> \fR
205 205 .ad
206 206 .br
207 207 .na
208 208 \fB\fB\&.\fR\fR
209 209 .ad
210 210 .RS 11n
211 211 The \fBa\fRppend command accepts zero or more lines of text and appends it
212 212 after the addressed line in the buffer. The current line (\fB\&.\fR) is left at
213 213 the last inserted line, or, if there were none, at the addressed line. Address
214 214 0 is legal for this command: it causes the ``appended'' text to be placed at
215 215 the beginning of the buffer. The maximum number of characters that may be
216 216 entered from a terminal is 256 per line (including the new-line character).
217 217 .RE
218 218
219 219 .sp
220 220 .ne 2
221 221 .na
222 222 \fB\fB(.,.)c\fR\fR
223 223 .ad
224 224 .br
225 225 .na
226 226 \fB<\fItext\fR>\fR
227 227 .ad
228 228 .br
229 229 .na
230 230 \fB\fB\&.\fR\fR
231 231 .ad
232 232 .RS 11n
233 233 The \fBc\fRhange command deletes the addressed lines from the buffer, then
234 234 accepts zero or more lines of text that replaces these lines in the buffer. The
235 235 current line (\fB\&.\fR) is left at the last line input, or, if there were
236 236 none, at the first line that was not deleted. If the lines deleted were
237 237 originally at the end of the buffer, the current line number will be set to the
238 238 address of the new last line. If no lines remain in the buffer, the current
239 239 line number will be set to 0.
240 240 .sp
241 241 .ne 2
242 242 .na
243 243 \fB\fB/usr/xpg4/bin/ed\fR\fR
244 244 .ad
245 245 .RS 20n
246 246 Address 0 is not legal for this command.
247 247 .RE
248 248
249 249 .sp
250 250 .ne 2
251 251 .na
252 252 \fB\fB/usr/xpg6/bin/ed\fR\fR
253 253 .ad
254 254 .RS 20n
255 255 Address 0 is valid for this command. It is interpreted as if the address 1 were
256 256 specified.
257 257 .RE
258 258
259 259 .RE
260 260
261 261 .sp
262 262 .ne 2
263 263 .na
264 264 \fB\fBC\fR\fR
265 265 .ad
266 266 .RS 11n
267 267 Same as the \fBX\fR command, described later, except that \fBed\fR assumes all
268 268 text read in for the \fBe\fR and \fBr\fR commands is encrypted unless a null
269 269 key is typed in.
270 270 .RE
271 271
272 272 .sp
273 273 .ne 2
274 274 .na
275 275 \fB\fB(.,.)d\fR\fR
276 276 .ad
277 277 .RS 11n
278 278 The \fBd\fRelete command deletes the addressed lines from the buffer. The line
279 279 after the last line deleted becomes the current line. If the lines deleted were
280 280 originally at the end of the buffer, the new last line becomes the current
281 281 line. If no lines remain in the buffer, the current line number will be set to
282 282 0.
283 283 .RE
284 284
285 285 .sp
286 286 .ne 2
287 287 .na
288 288 \fB\fBe\fR \fIfile\fR\fR
289 289 .ad
290 290 .RS 11n
291 291 The \fBe\fRdit command deletes the entire contents of the buffer and then reads
292 292 the contents of \fIfile\fR into the buffer. The current line (\fB\&.\fR) is set
293 293 to the last line of the buffer. If \fIfile\fR is not given, the currently
294 294 remembered file name, if any, is used (see the \fBf\fR command). The number of
295 295 bytes read will be written to standard output, unless the \fB-s\fR option was
296 296 specified, in the following format:
297 297 .sp
298 298 \fB"%d\en"\fR <\fInumber of bytes read\fR>
299 299 .sp
300 300 \fIfile\fR is remembered for possible use as a default file name in subsequent
301 301 \fBe\fR, \fBE\fR, \fBr\fR, and \fBw\fR commands. If \fIfile\fR is replaced by
302 302 \fB!\fR, the rest of the line is taken to be a shell ( \fBsh\fR(1)) command
303 303 whose output is to be read. Such a shell command is \fInot\fR remembered as the
304 304 current file name. See also DIAGNOSTICS below. All marks are discarded upon
305 305 the completion of a successful \fBe\fR command. If the buffer has changed since
306 306 the last time the entire buffer was written, the user is warned, as described
307 307 previously.
308 308 .RE
309 309
310 310 .sp
311 311 .ne 2
312 312 .na
313 313 \fB\fBE\fR \fIfile\fR\fR
314 314 .ad
315 315 .RS 11n
316 316 The \fBE\fRdit command is like \fBe\fR, except that the editor does not check
317 317 to see if any changes have been made to the buffer since the last \fBw\fR
318 318 command.
319 319 .RE
320 320
321 321 .sp
322 322 .ne 2
323 323 .na
324 324 \fB\fBf\fR \fIfile\fR\fR
325 325 .ad
326 326 .RS 11n
327 327 If \fIfile\fR is given, the \fBf\fR command changes the currently remembered
328 328 path name to \fIfile\fR. Whether the name is changed or not, the \fBf\fR
329 329 command then writes the (possibly new) currently remembered path name to the
330 330 standard output in the following format:
331 331 .sp
332 332 \fB"%s\en"\fR\fIpathname\fR
333 333 .sp
334 334 The current line number is unchanged.
335 335 .RE
336 336
337 337 .sp
338 338 .ne 2
339 339 .na
340 340 \fB\fB(1,$)g/\fR\fIRE\fR\fB/\fR\fIcommand list\fR\fR
341 341 .ad
342 342 .RS 26n
343 343 In the \fBg\fRlobal command, the first step is to mark every line that matches
344 344 the given \fIRE\fR. Then, for every such line, the given \fIcommand list\fR is
345 345 executed with the current line (\fB\&.\fR) initially set to that line. When the
346 346 \fBg\fR command completes, the current line number has the value assigned by
347 347 the last command in the command list. If there were no matching lines, the
348 348 current line number is not changed. A single command or the first of a list of
349 349 commands appears on the same line as the global command. All lines of a
350 350 multi-line list except the last line must be ended with a backslash
351 351 (\fB\e\fR\|); \fBa\fR, \fBi\fR, and \fBc\fR commands and associated input are
352 352 permitted. The \fB\&.\fR terminating input mode may be omitted if it would be
353 353 the last line of the \fIcommand list\fR. An empty \fIcommand list\fR is
354 354 equivalent to the \fBp\fR command. The \fBg\fR, \fBG\fR, \fBv\fR, \fBV\fR, and
355 355 \fB!\fR commands are \fInot\fR permitted in the \fIcommand list\fR. See also
356 356 the NOTES and the last paragraph before FILES below. Any character other than
357 357 space or newline can be used instead of a slash to delimit the \fIRE\fR. Within
358 358 the \fIRE\fR, the \fIRE\fR delimiter itself can be used as a literal character
359 359 if it is preceded by a backslash.
360 360 .RE
361 361
362 362 .sp
363 363 .ne 2
364 364 .na
365 365 \fB\fB(1,$)G/\fR\fIRE\fR\fB/\fR\fR
366 366 .ad
367 367 .RS 26n
368 368 In the interactive \fBG\fRlobal command, the first step is to mark every line
369 369 that matches the given \fIRE\fR. Then, for every such line, that line is
370 370 written to standard output, the current line (\fB\&.\fR) is changed to that
371 371 line, and any \fIone\fR command (other than one of the \fBa\fR, \fBc\fR,
372 372 \fBi\fR, \fBg\fR, \fBG\fR, \fBv\fR, and \fBV\fR commands) may be input and is
373 373 executed. After the execution of that command, the next marked line is written,
374 374 and so on. A new-line acts as a null command. An \fB&\fR causes the
375 375 re-execution of the most recent non-null command executed within the current
376 376 invocation of \fBG\fR. \fBNote:\fR The commands input as part of the execution
377 377 of the \fBG\fR command may address and affect \fBany\fR lines in the buffer.
378 378 The final value of the current line number is the value set by the last command
379 379 successfully executed. (Notice that the last command successfully executed is
380 380 the \fBG\fR command itself if a command fails or the null command is
381 381 specified.) If there were no matching lines, the current line number is not
382 382 changed. The \fBG\fR command can be terminated by a \fBSIGINT\fR signal. The
383 383 \fBG\fR command can be terminated by an interrupt signal (ASCII DEL or BREAK).
384 384 Any character other than space or newline can be used instead of a slash to
385 385 delimit the \fIRE\fR. Within the \fIRE\fR, the \fIRE\fR delimiter itself can be
386 386 used as a literal character if it is preceded by a backslash.
387 387 .RE
388 388
389 389 .sp
390 390 .ne 2
391 391 .na
392 392 \fB\fBh\fR\fR
393 393 .ad
394 394 .RS 26n
395 395 The \fBhelp\fR command gives a short error message that explains the reason for
396 396 the most recent \fB?\fR diagnostic. The current line number is unchanged.
397 397 .RE
398 398
399 399 .sp
400 400 .ne 2
401 401 .na
402 402 \fB\fBH\fR\fR
403 403 .ad
404 404 .RS 26n
405 405 The \fBHelp\fR command causes \fBed\fR to enter a mode in which error messages
406 406 are written for all subsequent \fB?\fR diagnostics. It also explains the
407 407 previous \fB?\fR if there was one. The \fBH\fR command alternately turns this
408 408 mode on and off; it is initially off. The current line number is unchanged.
409 409 .RE
410 410
411 411 .sp
412 412 .ne 2
413 413 .na
414 414 \fB\fB(.,.)i\fR\fR
415 415 .ad
416 416 .br
417 417 .na
418 418 \fB<\fItext\fR>\fR
419 419 .ad
420 420 .br
421 421 .na
422 422 \fB\fB\&.\fR\fR
423 423 .ad
424 424 .RS 26n
425 425 The \fBinsert\fR command accepts zero or more lines of text and inserts it
426 426 before the addressed line in the buffer. The current line (\fB\&.\fR) is left
427 427 at the last inserted line, or, if there were none, at the addressed line. This
428 428 command differs from the \fBa\fR command only in the placement of the input
429 429 text. The maximum number of characters that may be entered from a terminal is
430 430 256 per line (including the new-line character).
431 431 .sp
432 432 .ne 2
433 433 .na
434 434 \fB\fB/usr/xpg4/bin/ed\fR\fR
435 435 .ad
436 436 .RS 20n
437 437 Address 0 is not legal for this command.
438 438 .RE
439 439
440 440 .sp
441 441 .ne 2
442 442 .na
443 443 \fB\fB/usr/xpg6/bin/ed\fR\fR
444 444 .ad
445 445 .RS 20n
446 446 Address 0 is valid for this command. It is interpreted as if the address 1 were
447 447 specified.
448 448 .RE
449 449
450 450 .RE
451 451
452 452 .sp
453 453 .ne 2
454 454 .na
455 455 \fB\fB(.,.+1)j\fR\fR
456 456 .ad
457 457 .RS 26n
458 458 The \fBj\fRoin command joins contiguous lines by removing the appropriate
459 459 new-line characters. If exactly one address is given, this command does
460 460 nothing. If lines are joined, the current line number is set to the address of
461 461 the joined line. Otherwise, the current line number is unchanged.
462 462 .RE
463 463
464 464 .sp
465 465 .ne 2
466 466 .na
467 467 \fB\fB(.)k\fR\fIx\fR\fR
468 468 .ad
469 469 .RS 26n
470 470 The mar\fBk\fR command marks the addressed line with name \fIx\fR, which must
471 471 be an ASCII lower-case letter (\fBa\fR\fB-\fR\fBz\fR). The address \fI a\'x\fR
472 472 then addresses this line. The current line (\fB\&.\fR) is unchanged.
473 473 .RE
474 474
475 475 .sp
476 476 .ne 2
477 477 .na
478 478 \fB\fB(.,.)l\fR\fR
479 479 .ad
480 480 .RS 26n
481 481 The \fBl\fR command writes to standard output the addressed lines in a visually
482 482 unambiguous form. The characters ( \fB\e\e\fR, \fB\ea\fR, \fB\eb\fR, \fB\ef\fR,
483 483 \fB\er\fR, \fB\et\fR, \fB\ev\fR) are written as the corresponding escape
484 484 sequence. The \fB\en\fR in that table is not applicable. Non-printable
485 485 characters not in the table are written as one three-digit octal number (with a
486 486 preceding backslash character) for each byte in the character, with the most
487 487 significant byte first.
488 488 .sp
489 489 Long lines are folded, with the point of folding indicated by writing
490 490 backslash/newline character. The length at which folding occurs is unspecified,
491 491 but should be appropriate for the output device. The end of each line is marked
492 492 with a \fB$\fR. When using the \fB/usr/xpg6/bin/ed\fR command, the end of each
493 493 line is marked with a \fB$\fR due to folding, and \fB$\fR characters within the
494 494 text are written with a preceding backslash. An \fBl\fR command can be appended
495 495 to any other command other than \fBe\fR, \fBE\fR, \fBf\fR, \fBq\fR, \fBQ\fR,
496 496 \fBr\fR, \fBw\fR, or \fB!\fR. The current line number is set to the address of
497 497 the last line written.
498 498 .RE
499 499
500 500 .sp
501 501 .ne 2
502 502 .na
503 503 \fB\fB(.,.)m\fR\fIa\fR\fR
504 504 .ad
505 505 .RS 26n
506 506 The \fBm\fRove command repositions the addressed line(s) after the line
507 507 addressed by \fIa\fR. Address 0 is legal for \fIa\fR and causes the addressed
508 508 line(s) to be moved to the beginning of the file. It is an error if address
509 509 \fIa\fR falls within the range of moved lines. The current line (\fB\&.\fR) is
510 510 left at the last line moved.
511 511 .RE
512 512
513 513 .sp
514 514 .ne 2
515 515 .na
516 516 \fB\fB(.,.)n\fR\fR
517 517 .ad
518 518 .RS 26n
519 519 The \fBn\fRumber command writes the addressed lines, preceding each line by its
520 520 line number and a tab character. The current line (\fB\&.\fR) is left at the
521 521 last line written. The \fBn\fR command may be appended to any command other
522 522 than \fBe\fR, \fBE\fR, \fBf\fR, \fBq\fR, \fBQ\fR, \fBr\fR, \fBw\fR, or \fB!\fR.
523 523 .RE
524 524
525 525 .sp
526 526 .ne 2
527 527 .na
528 528 \fB\fB(.,.)p\fR\fR
529 529 .ad
530 530 .RS 26n
531 531 The \fBp\fRrint command writes the addressed lines to standard output. The
532 532 current line (\fB\&.\fR) is left at the last line written. The \fBp\fR command
533 533 may be appended to any command other than \fBe\fR, \fBE\fR, \fBf\fR, \fBq\fR,
534 534 \fBQ\fR, \fBr\fR, \fBw\fR, or \fB!\fR. For example, \fBdp\fR deletes the
535 535 current line and writes the new current line.
536 536 .RE
537 537
538 538 .sp
539 539 .ne 2
540 540 .na
541 541 \fB\fBP\fR\fR
542 542 .ad
543 543 .RS 26n
544 544 The \fBP\fR command causes \fBed\fR to prompt with an asterisk (\fB*\fR) (or
545 545 \fIstring\fR, if \fB-p\fR is specified) for all subsequent commands. The
546 546 \fBP\fR command alternatively turns this mode on and off; it is initially on if
547 547 the \fB-p\fR option is specified, otherwise off. The current line is unchanged.
548 548 .RE
549 549
550 550 .sp
551 551 .ne 2
552 552 .na
553 553 \fB\fBq\fR\fR
554 554 .ad
555 555 .RS 26n
556 556 The \fBq\fRuit command causes \fBed\fR to exit. If the buffer has changed since
557 557 the last time the entire buffer was written, the user is warned. See
558 558 DIAGNOSTICS.
559 559 .RE
560 560
561 561 .sp
562 562 .ne 2
563 563 .na
564 564 \fB\fBQ\fR\fR
565 565 .ad
566 566 .RS 26n
567 567 The editor exits without checking if changes have been made in the buffer since
568 568 the last \fBw\fR command.
569 569 .RE
570 570
571 571 .sp
572 572 .ne 2
573 573 .na
574 574 \fB\fB($)r\fR \fIfile\fR\fR
575 575 .ad
576 576 .RS 26n
577 577 The \fBr\fRead command reads the contents of \fIfile\fR into the buffer. If
578 578 \fIfile\fR is not given, the currently remembered file name, if any, is used
579 579 (see the \fBe\fR and \fBf\fR commands). The currently remembered file name is
580 580 \fBnot\fR changed unless \fIfile\fR is the very first file name mentioned since
581 581 \fBed\fR was invoked. Address 0 is legal for \fBr\fR and causes the file to be
582 582 read in at the beginning of the buffer. If the read is successful and the
583 583 \fB-s\fR option was not specified, the number of characters read is written to
584 584 standard output in the following format:
585 585 .sp
586 586 .in +2
587 587 .nf
588 588 \fB%d\en\fR, <\fInumber of bytes read\fR>
589 589 .fi
590 590 .in -2
591 591 .sp
592 592
593 593 The current line (\fB\&.\fR) is set to the last line read. If \fIfile\fR is
594 594 replaced by \fB!\fR, the rest of the line is taken to be a shell command (see
595 595 \fBsh\fR(1)) whose output is to be read. For example, \fB$r !ls\fR appends the
596 596 current directory to the end of the file being edited. Such a shell command is
597 597 \fBnot\fR remembered as the current file name.
598 598 .RE
599 599
600 600 .sp
601 601 .ne 2
602 602 .na
603 603 \fB\fB(.,.)s/\fR\fIRE\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR
604 604 .ad
605 605 .br
606 606 .na
607 607 \fB\fB(.,.)s/\fR\fIRE\fR\fB/\fR\fIreplacement\fR\fB/\fR\fIcount\fR,
608 608 \fIcount\fR=[\fB1-2047\fR]\fR
609 609 .ad
610 610 .br
611 611 .na
612 612 \fB\fB(.,.)s/\fR\fIRE\fR\fB/\fR\fIreplacement\fR\fB/g\fR\fR
613 613 .ad
614 614 .br
615 615 .na
616 616 \fB\fB(.,.)s/\fR\fIRE\fR\fB/\fR\fIreplacement\fR\fB/l\fR\fR
617 617 .ad
618 618 .br
619 619 .na
620 620 \fB\fB(.,.)s/\fR\fIRE\fR\fB/\fR\fIreplacement\fR\fB/n\fR\fR
621 621 .ad
622 622 .br
623 623 .na
624 624 \fB\fB(.,.)s/\fR\fIRE\fR\fB/\fR\fIreplacement\fR\fB/p\fR\fR
625 625 .ad
626 626 .sp .6
627 627 .RS 4n
628 628 The \fBs\fRubstitute command searches each addressed line for an occurrence of
629 629 the specified \fIRE\fR. Zero or more substitution commands can be specified. In
630 630 each line in which a match is found, all (non-overlapped) matched strings are
631 631 replaced by the \fIreplacement\fR if the global replacement indicator \fBg\fR
632 632 appears after the command. If the global indicator does not appear, only the
633 633 first occurrence of the matched string is replaced. If a number \fIcount\fR
634 634 appears after the command, only the \fIcount\fR-th occurrence of the matched
635 635 string on each addressed line is replaced. It is an error if the substitution
636 636 fails on \fBall\fR addressed lines. Any character other than space or new-line
637 637 may be used instead of the slash (\fB/\fR) to delimit the \fIRE\fR and the
638 638 \fIreplacement\fR. The current line (\fB\&.\fR) is left at the last line on
639 639 which a substitution occurred. Within the \fIRE\fR, the \fIRE\fR delimiter
640 640 itself can be used as a literal character if it is preceded by a backslash. See
641 641 also the last paragraph before FILES below.
642 642 .sp
643 643 An ampersand (\fB&\fR) appearing in the \fIreplacement\fR is replaced by the
644 644 string matching the \fIRE\fR on the current line. The special meaning of
645 645 \fB&\fR in this context may be suppressed by preceding it by \fB\e\fR\|. As a
646 646 more general feature, the characters \fB\e\fR\fIn\fR, where \fIn\fR is a digit,
647 647 are replaced by the text matched by the \fIn\fR-th regular subexpression of the
648 648 specified \fIRE\fR enclosed between \fB\e(\fR and \fB\e)\fR\&. When nested
649 649 parenthesized subexpressions are present, \fIn\fR is determined by counting
650 650 occurrences of \fB\e(\fR starting from the left. When the character \fB%\fR is
651 651 the only character in the \fIreplacement\fR, the \fIreplacement\fR used in the
652 652 most recent substitute command is used as the \fIreplacement\fR in the current
653 653 substitute command. If there was no previous substitute command, the use of
654 654 \fB%\fR in this manner is an error. The \fB%\fR loses its special meaning when
655 655 it is in a replacement string of more than one character or is preceded by a
656 656 \fB\e\fR\|. For each backslash (\e) encountered in scanning \fIreplacement\fR
657 657 from beginning to end, the following character loses its special meaning (if
658 658 any). It is unspecified what special meaning is given to any character other
659 659 than \fB&\fR, \fB\e\fR, \fB%\fR, or digits.
660 660 .sp
661 661 A line may be split by substituting a new-line character into it. The new-line
662 662 in the \fIreplacement\fR must be escaped by preceding it by \fB\e\fR\&. Such
663 663 substitution cannot be done as part of a \fBg\fR or \fBv\fR command list. The
664 664 current line number is set to the address of the last line on which a
665 665 substitution is performed. If no substitution is performed, the current line
666 666 number is unchanged. If a line is split, a substitution is considered to have
667 667 been performed on each of the new lines for the purpose of determining the new
668 668 current line number. A substitution is considered to have been performed even
669 669 if the replacement string is identical to the string that it replaces.
670 670 .sp
671 671 The substitute command supports the following indicators:
672 672 .sp
673 673 .ne 2
674 674 .na
675 675 \fB\fIcount\fR\fR
676 676 .ad
677 677 .RS 9n
678 678 Substitute for the \fIcount\fRth occurrence only of the \fIRE\fR found on each
679 679 addressed line. \fIcount\fR must be between \fB1\fR-\fB2047\fR.
680 680 .RE
681 681
682 682 .sp
683 683 .ne 2
684 684 .na
685 685 \fB\fBg\fR\fR
686 686 .ad
687 687 .RS 9n
688 688 Globally substitute for all non-overlapping instances of the \fIRE\fR rather
689 689 than just the first one. If both \fBg\fR and \fIcount\fR are specified, the
690 690 results are unspecified.
691 691 .RE
692 692
693 693 .sp
694 694 .ne 2
695 695 .na
696 696 \fB\fBl\fR\fR
697 697 .ad
698 698 .RS 9n
699 699 Write to standard output the final line in which a substitution was made. The
700 700 line is written in the format specified for the \fBl\fR command.
701 701 .RE
702 702
703 703 .sp
704 704 .ne 2
705 705 .na
706 706 \fB\fBn\fR\fR
707 707 .ad
708 708 .RS 9n
709 709 Write to standard output the final line in which a substitution was made. The
710 710 line is written in the format specified for the \fBn\fR command.
711 711 .RE
712 712
713 713 .sp
714 714 .ne 2
715 715 .na
716 716 \fB\fBp\fR\fR
717 717 .ad
718 718 .RS 9n
719 719 Write to standard output the final line in which a substitution was made. The
720 720 line will be written in the format specified for the \fBp\fR command.
721 721 .RE
722 722
723 723 .RE
724 724
725 725 .sp
726 726 .ne 2
727 727 .na
728 728 \fB\fB(.,.)t\fR\fIa\fR\fR
729 729 .ad
730 730 .sp .6
731 731 .RS 4n
732 732 This command acts just like the \fBm\fR command, except that a \fIcopy\fR of
733 733 the addressed lines is placed after address \fBa\fR (which may be 0). The
734 734 current line (\fB\&.\fR) is left at the last line copied.
735 735 .RE
736 736
737 737 .sp
738 738 .ne 2
739 739 .na
740 740 \fB\fBu\fR\fR
741 741 .ad
742 742 .sp .6
743 743 .RS 4n
744 744 The \fBu\fRndo command nullifies the effect of the most recent command that
745 745 modified anything in the buffer, namely the most recent \fBa\fR, \fBc\fR,
746 746 \fBd\fR, \fBg\fR, \fBi\fR, \fBj\fR, \fBm\fR, \fBr\fR, \fBs\fR, \fBt\fR,
747 747 \fBu\fR, \fBv\fR, \fBG\fR, or \fBV\fR command. All changes made to the buffer
748 748 by a \fBg\fR, \fBG\fR, \fBv\fR, or \fBV\fR global command is undone as a single
749 749 change.If no changes were made by the global command (such as with \fBg/\fR
750 750 \fIRE\fR\fB/p\fR), the \fBu\fR command has no effect. The current line number
751 751 is set to the value it had immediately before the command being undone
752 752 started.
753 753 .RE
754 754
755 755 .sp
756 756 .ne 2
757 757 .na
758 758 \fB\fB(1,$)v/\fR\fIRE\fR\fB/\fR\fIcommand list\fR\fR
759 759 .ad
760 760 .sp .6
761 761 .RS 4n
762 762 This command is the same as the global command \fBg\fR, except that the lines
763 763 marked during the first step are those that do \fBnot\fR match the \fIRE\fR.
764 764 .RE
765 765
766 766 .sp
767 767 .ne 2
768 768 .na
769 769 \fB\fB(1,$)V/\fR\fIRE\fR\fB/\fR\fR
770 770 .ad
771 771 .sp .6
772 772 .RS 4n
773 773 This command is the same as the interactive global command \fBG\fR, except that
774 774 the lines that are marked during the first step are those that do \fBnot\fR
775 775 match the \fIRE\fR.
776 776 .RE
777 777
778 778 .sp
779 779 .ne 2
780 780 .na
781 781 \fB\fB(1,$)w\fR \fIfile\fR\fR
782 782 .ad
783 783 .sp .6
784 784 .RS 4n
785 785 The \fBw\fRrite command writes the addressed lines into \fIfile\fR. If
786 786 \fIfile\fR does not exist, it is created with mode \fB666\fR (readable and
787 787 writable by everyone), unless your file creation mask dictates otherwise. See
788 788 the description of the \fBumask\fR special command on \fBsh\fR(1). The
789 789 currently remembered file name is \fBnot\fR changed unless \fIfile\fR is the
790 790 very first file name mentioned since \fBed\fR was invoked. If no file name is
791 791 given, the currently remembered file name, if any, is used (see the \fBe\fR and
792 792 \fBf\fR commands). The current line (\fB\&.\fR) is unchanged. If the command is
793 793 successful, the number of characters written is printed, unless the \fB-s\fR
794 794 option is specified in the following format:
795 795 .sp
796 796 .in +2
797 797 .nf
798 798 \fB"%d\en",\fR<\fInumber of bytes written\fR>
799 799 .fi
800 800 .in -2
801 801 .sp
802 802
803 803 If \fIfile\fR is replaced by \fB!\fR, the rest of the line is taken to be a
804 804 shell (see \fBsh\fR(1)) command whose standard input is the addressed lines.
805 805 Such a shell command is \fInot\fR remembered as the current path name. This
806 806 usage of the write command with \fB!\fR is to be considered as a ``last \fBw\fR
807 807 command that wrote the entire buffer''.
808 808 .RE
809 809
810 810 .sp
811 811 .ne 2
812 812 .na
813 813 \fB\fB(1,$)W\fR \fIfile\fR\fR
814 814 .ad
815 815 .RS 19n
816 816 This command is the same as the \fBw\fRrite command above, except that it
817 817 appends the addressed lines to the end of \fIfile\fR if it exists. If
818 818 \fIfile\fR does not exist, it is created as described above for the \fBw\fR
819 819 command.
820 820 .RE
821 821
822 822 .sp
823 823 .ne 2
824 824 .na
825 825 \fB\fBX\fR\fR
826 826 .ad
827 827 .RS 19n
828 828 An educated guess is made to determine whether text read for the \fBe\fR and
829 829 \fBr\fR commands is encrypted. A null key turns off encryption. Subsequent
830 830 \fBe\fR, \fBr\fR, and \fBw\fR commands will use this key to encrypt or decrypt
831 831 the text. An explicitly empty key turns off encryption. Also, see the \fB-x\fR
832 832 option of \fBed\fR.
833 833 .RE
834 834
835 835 .sp
836 836 .ne 2
837 837 .na
838 838 \fB\fB($)=\fR\fR
839 839 .ad
840 840 .RS 19n
841 841 The line number of the addressed line is written to standard output in the
842 842 following format:
843 843 .sp
844 844 .in +2
845 845 .nf
846 846 \fB"%d\en"\fR<\fIline number\fR>
847 847 .fi
848 848 .in -2
849 849 .sp
850 850
851 851 The current line number is unchanged by this command.
852 852 .RE
853 853
854 854 .sp
855 855 .ne 2
856 856 .na
857 857 \fB\fB!\fR\fIshell command\fR\fR
858 858 .ad
859 859 .RS 19n
860 860 The remainder of the line after the \fB!\fR is sent to the UNIX system shell
861 861 (see \fBsh\fR(1)) to be interpreted as a command. Within the text of that
862 862 command, the unescaped character \fB%\fR is replaced with the remembered file
863 863 name. If a \fB!\fR appears as the first character of the shell command, it is
864 864 replaced with the text of the previous shell command. Thus, \fB!!\fR repeats
865 865 the last shell command. If any replacements of \fB%\fR or \fB!\fR are
866 866 performed, the modified line is written to the standard output before
867 867 \fIcommand\fR is executed. The \fB!\fR command will write:
868 868 .sp
869 869 \fB"!\en"\fR
870 870 .sp
871 871 to standard output upon completion, unless the \fB-s\fR option is specified.
872 872 The current line number is unchanged.
873 873 .RE
874 874
875 875 .sp
876 876 .ne 2
877 877 .na
878 878 \fB\fB(.+1)\fR<new-line>\fR
879 879 .ad
880 880 .RS 19n
881 881 An address alone on a line causes the addressed line to be written. A new-line
882 882 alone is equivalent to \fB\&.+1p\fR. It is useful for stepping forward through
883 883 the buffer. The current line number will be set to the address of the written
884 884 line.
885 885 .RE
886 886
887 887 .sp
888 888 .LP
889 889 If an interrupt signal (ASCII DEL or BREAK) is sent, \fBed\fR writes a
890 890 "\fB?\en\fR" and returns to \fBits\fR command level.
891 891 .sp
892 892 .LP
893 893 The \fBed\fR utility takes the standard action for all signals with the
894 894 following exceptions:
895 895 .sp
896 896 .ne 2
897 897 .na
898 898 \fB\fBSIGINT\fR\fR
899 899 .ad
900 900 .RS 10n
901 901 The \fBed\fR utility interrupts its current activity, writes the string
902 902 "\fB?\en\fR" to standard output, and returns to command mode.
903 903 .RE
904 904
905 905 .sp
906 906 .ne 2
907 907 .na
908 908 \fB\fBSIGHUP\fR\fR
909 909 .ad
910 910 .RS 10n
911 911 If the buffer is not empty and has changed since the last write, the \fBed\fR
912 912 utility attempts to write a copy of the buffer in a file. First, the file named
913 913 \fBed.hup\fR in the current directory is used. If that fails, the file named
914 914 \fBed.hup\fR in the directory named by the \fBHOME\fR environment variable is
915 915 used. In any case, the \fBed\fR utility exits without returning to command
916 916 mode.
917 917 .RE
918 918
919 919 .sp
920 920 .LP
921 921 Some size limitations are in effect: 512 characters in a line, 256 characters
922 922 in a global command list, and 255 characters in the path name of a file
923 923 (counting slashes). The limit on the number of lines depends on the amount of
924 924 user memory. Each line takes 1 word.
925 925 .sp
926 926 .LP
927 927 When reading a file, \fBed\fR discards \fBASCII\fR and \fBNUL\fR characters.
928 928 .sp
929 929 .LP
930 930 If a file is not terminated by a new-line character, \fBed\fR adds one and puts
931 931 out a message explaining what it did.
932 932 .sp
933 933 .LP
934 934 If the closing delimiter of an \fBRE\fR or of a replacement string (for
935 935 example, \fB/\fR) would be the last character before a new-line, that delimiter
936 936 may be omitted, in which case the addressed line is written. The following
937 937 pairs of commands are equivalent:
938 938 .sp
939 939 .ne 2
940 940 .na
941 941 \fB\fBs/s1/s2\fR\fR
942 942 .ad
943 943 .RS 11n
944 944 \fBs/s1/s2/p\fR
945 945 .RE
946 946
947 947 .sp
948 948 .ne 2
949 949 .na
950 950 \fB\fBg/s1\fR\fR
951 951 .ad
952 952 .RS 11n
953 953 \fBg/s1/p\fR
954 954 .RE
955 955
956 956 .sp
957 957 .ne 2
958 958 .na
959 959 \fB\fB?s1\fR\fR
960 960 .ad
961 961 .RS 11n
962 962 \fB?s1?\fR
963 963 .RE
964 964
965 965 .sp
966 966 .LP
967 967 If an invalid command is entered, \fBed\fR writes the string:
968 968 .sp
969 969 .LP
970 970 \fB"?\en"\fR
971 971 .sp
972 972 .LP
973 973 (followed by an explanatory message if \fIhelp mode\fR has been enabled by the
974 974 \fBH\fR command) to standard output and continues in command mode with the
975 975 current line number unchanged.
976 976 .SH OPTIONS
977 977 .sp
978 978 .ne 2
979 979 .na
980 980 \fB\fB-C\fR\fR
981 981 .ad
982 982 .RS 13n
983 983 Encryption option. The same as the \fB-x\fR option, except that \fBed\fR
984 984 simulates a \fBC\fR command. The \fBC\fR command is like the \fBX\fR command,
985 985 except that all text read in is assumed to have been encrypted.
986 986 .RE
987 987
988 988 .sp
989 989 .ne 2
990 990 .na
991 991 \fB\fB\fR\fB-p\fR\fIstring\fR \fR
992 992 .ad
993 993 .RS 13n
994 994 Allows the user to specify a prompt string. By default, there is no prompt
995 995 string.
996 996 .RE
997 997
998 998 .sp
999 999 .ne 2
1000 1000 .na
1001 1001 \fB\fB-s\fR | \fB-;\fR\fR
1002 1002 .ad
1003 1003 .RS 13n
1004 1004 Suppresses the writing of character counts by \fBe\fR, \fBr\fR, and \fBw\fR
1005 1005 commands, of diagnostics from \fBe\fR and \fBq\fR commands, and of the \fB!\fR
1006 1006 prompt after a \fB!\fR\fIshell command\fR.
1007 1007 .RE
1008 1008
1009 1009 .sp
1010 1010 .ne 2
1011 1011 .na
1012 1012 \fB\fB-x\fR\fR
1013 1013 .ad
1014 1014 .RS 13n
1015 1015 Encryption option. When \fB-x\fR is used, \fBed\fR simulates an \fBX\fR command
1016 1016 and prompts the user for a key. The \fBX\fR command makes an educated guess to
1017 1017 determine whether text read in is encrypted or not. The temporary buffer file
1018 1018 is encrypted also, using a transformed version of the key typed in for the
1019 1019 \fB-x\fR option. See NOTES.
1020 1020 .RE
1021 1021
1022 1022 .SH OPERANDS
1023 1023 .sp
1024 1024 .LP
1025 1025 The following operand is supported:
1026 1026 .sp
1027 1027 .ne 2
1028 1028 .na
1029 1029 \fB\fIfile\fR\fR
1030 1030 .ad
1031 1031 .RS 8n
1032 1032 If \fIfile\fR is specified, \fBed\fR simulates an \fBe\fR command on the file
1033 1033 named by the path name \fIfile\fR before accepting commands from the standard
1034 1034 input.
1035 1035 .RE
1036 1036
1037 1037 .SH USAGE
1038 1038 .sp
1039 1039 .LP
1040 1040 See \fBlargefile\fR(5) for the description of the behavior of \fBed\fR and
1041 1041 \fBred\fR when encountering files greater than or equal to 2 Gbyte ( 2^31
1042 1042 bytes).
1043 1043 .SH ENVIRONMENT VARIABLES
1044 1044 .sp
1045 1045 .LP
1046 1046 See \fBenviron\fR(5) for descriptions of the following environment variables
1047 1047 that affect the execution of \fBed\fR: \fBHOME\fR, \fBLANG\fR, \fBLC_ALL\fR,
1048 1048 \fBLC_CTYPE\fR, \fBLC_COLLATE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
1049 1049 .SH EXIT STATUS
1050 1050 .sp
1051 1051 .LP
1052 1052 The following exit values are returned:
1053 1053 .sp
1054 1054 .ne 2
1055 1055 .na
1056 1056 \fB\fB0\fR\fR
1057 1057 .ad
1058 1058 .RS 6n
1059 1059 Successful completion without any file or command errors.
1060 1060 .RE
1061 1061
1062 1062 .sp
1063 1063 .ne 2
1064 1064 .na
1065 1065 \fB\fB>0\fR\fR
1066 1066 .ad
1067 1067 .RS 6n
1068 1068 An error occurred.
1069 1069 .RE
1070 1070
1071 1071 .SH FILES
1072 1072 .sp
1073 1073 .ne 2
1074 1074 .na
1075 1075 \fB\fB$TMPDIR\fR\fR
1076 1076 .ad
1077 1077 .RS 12n
1078 1078 If this environment variable is not \fINULL\fR, its value is used in place of
1079 1079 \fB/var/tmp\fR as the directory name for the temporary work file.
1080 1080 .RE
1081 1081
1082 1082 .sp
1083 1083 .ne 2
1084 1084 .na
1085 1085 \fB\fB/var/tmp\fR\fR
1086 1086 .ad
1087 1087 .RS 12n
1088 1088 If \fB/var/tmp\fR exists, it is used as the directory name for the temporary
1089 1089 work file.
1090 1090 .RE
1091 1091
1092 1092 .sp
1093 1093 .ne 2
1094 1094 .na
1095 1095 \fB\fB/tmp\fR\fR
1096 1096 .ad
1097 1097 .RS 12n
1098 1098 If the environment variable \fBTMPDIR\fR does not exist or is \fINULL,\fR and
1099 1099 if \fB/var/tmp\fR does not exist, then \fB/tmp\fR is used as the directory name
1100 1100 for the temporary work file.
1101 1101 .RE
1102 1102
1103 1103 .sp
1104 1104 .ne 2
1105 1105 .na
1106 1106 \fB\fBed.hup\fR\fR
1107 1107 .ad
1108 1108 .RS 12n
1109 1109 Work is saved here if the terminal is hung up.
1110 1110 .RE
1111 1111
1112 1112 .SH ATTRIBUTES
1113 1113 .sp
1114 1114 .LP
1115 1115 See \fBattributes\fR(5) for descriptions of the following attributes:
1116 1116 .SS "/usr/bin/ed, /usr/bin/red"
1117 1117 .sp
1118 1118
1119 1119 .sp
1120 1120 .TS
1121 1121 box;
1122 1122 c | c
1123 1123 l | l .
1124 1124 ATTRIBUTE TYPE ATTRIBUTE VALUE
1125 1125 _
1126 1126 CSI Enabled
1127 1127 .TE
1128 1128
1129 1129 .SS "/usr/xpg4/bin/ed"
1130 1130 .sp
1131 1131
1132 1132 .sp
1133 1133 .TS
1134 1134 box;
1135 1135 c | c
1136 1136 l | l .
1137 1137 ATTRIBUTE TYPE ATTRIBUTE VALUE
1138 1138 _
1139 1139 CSI Enabled
1140 1140 _
1141 1141 Interface Stability Standard
1142 1142 .TE
1143 1143
1144 1144 .SS "/usr/xpg6/bin/ed"
1145 1145 .sp
1146 1146
1147 1147 .sp
1148 1148 .TS
1149 1149 box;
1150 1150 c | c
1151 1151 l | l .
↓ open down ↓ |
1151 lines elided |
↑ open up ↑ |
1152 1152 ATTRIBUTE TYPE ATTRIBUTE VALUE
1153 1153 _
1154 1154 CSI Enabled
1155 1155 _
1156 1156 Interface Stability Standard
1157 1157 .TE
1158 1158
1159 1159 .SH SEE ALSO
1160 1160 .sp
1161 1161 .LP
1162 -\fBbfs\fR(1), \fBedit\fR(1), \fBex\fR(1), \fBgrep\fR(1), \fBksh\fR(1),
1162 +\fBedit\fR(1), \fBex\fR(1), \fBgrep\fR(1), \fBksh\fR(1),
1163 1163 \fBsed\fR(1), \fBsh\fR(1), \fBstty\fR(1), \fBumask\fR(1), \fBvi\fR(1),
1164 1164 \fBfspec\fR(4), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5),
1165 1165 \fBregex\fR(5), \fBstandards\fR(5)
1166 1166 .SH DIAGNOSTICS
1167 1167 .sp
1168 1168 .ne 2
1169 1169 .na
1170 1170 \fB\fB?\fR\fR
1171 1171 .ad
1172 1172 .RS 9n
1173 1173 for command errors.
1174 1174 .RE
1175 1175
1176 1176 .sp
1177 1177 .ne 2
1178 1178 .na
1179 1179 \fB\fB?\fR\fIfile\fR\fR
1180 1180 .ad
1181 1181 .RS 9n
1182 1182 for an inaccessible file. Use the \fBh\fRelp and \fBH\fRelp commands for
1183 1183 detailed explanations.
1184 1184 .RE
1185 1185
1186 1186 .sp
1187 1187 .LP
1188 1188 If changes have been made in the buffer since the last \fBw\fR command that
1189 1189 wrote the entire buffer, \fBed\fR warns the user if an attempt is made to
1190 1190 destroy \fBed\fR's buffer via the \fBe\fR or \fBq\fR commands. It writes
1191 1191 \fB?\fR and allows one to continue editing. A second \fBe\fR or \fBq\fR command
1192 1192 at this point will take effect. The \fB-s\fR command-line option inhibits this
1193 1193 feature.
1194 1194 .SH NOTES
1195 1195 .sp
1196 1196 .LP
1197 1197 The \fB-\fR option, although it continues to be supported, has been replaced in
1198 1198 the documentation by the \fB-s\fR option that follows the \fBCommand Syntax
1199 1199 Standard\fR (see \fBIntro\fR(1)).
1200 1200 .sp
1201 1201 .LP
1202 1202 A \fB!\fR command cannot be subject to a \fBg\fR or a \fBv\fR command.
1203 1203 .sp
1204 1204 .LP
1205 1205 The \fB!\fR command and the \fB!\fR escape from the \fBe\fR, \fBr\fR, and
1206 1206 \fBw\fR commands cannot be used if the editor is invoked from a restricted
1207 1207 shell (see \fBsh\fR(1)).
1208 1208 .sp
1209 1209 .LP
1210 1210 The sequence \fB\en\fR in an \fBRE\fR does not match a new-line character.
1211 1211 .sp
1212 1212 .LP
1213 1213 If the editor input is coming from a command file (for example, \fBed\fR
1214 1214 \fIfile\fR \fB<\fR \fIed_cmd_file\fR), the editor exits at the first failure.
1215 1215 .sp
1216 1216 .LP
1217 1217 Loading an alternate \fBmalloc()\fR library using the environment variable
1218 1218 \fBLD_PRELOAD\fR can cause problems for \fB/usr/bin/ed\fR.
↓ open down ↓ |
46 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX