1 | .TH ED 1
|
---|
2 | .SH NAME
|
---|
3 | ed \- editor
|
---|
4 | .SH SYNOPSIS
|
---|
5 | \fBed \fIfile\fR
|
---|
6 | .br
|
---|
7 | .de FL
|
---|
8 | .TP
|
---|
9 | \\fB\\$1\\fR
|
---|
10 | \\$2
|
---|
11 | ..
|
---|
12 | .de EX
|
---|
13 | .TP 20
|
---|
14 | \\fB\\$1\\fR
|
---|
15 | # \\$2
|
---|
16 | ..
|
---|
17 | .SH OPTIONS
|
---|
18 | .FL "\-" "Suppress line/byte count messages (for in scripts)"
|
---|
19 | .SH EXAMPLES
|
---|
20 | .EX "ed prog.c" "Edit \fIprog.c\fR"
|
---|
21 | .EX "echo '1,$p' | ed - file" "Odd way to write 'cat file'"
|
---|
22 | .SH DESCRIPTION
|
---|
23 | .PP
|
---|
24 | \fIEd\fR is functionally equivalent to the standard V7 editor, ed.
|
---|
25 | It supports the following commands:
|
---|
26 | .PP
|
---|
27 | .nf
|
---|
28 | .ta 0.5i 0.95i
|
---|
29 | (.) a: append
|
---|
30 | (.,.) c: change
|
---|
31 | (.,.) d: delete
|
---|
32 | e: edit new file"
|
---|
33 | f: print name of edited file"
|
---|
34 | (1,$) g: global command
|
---|
35 | (.) i: insert
|
---|
36 | (.,.+1) j: join lines together
|
---|
37 | (.) k: mark
|
---|
38 | (.) l: print with special characters in octal
|
---|
39 | (.,.) m: move
|
---|
40 | (.,.) p: print
|
---|
41 | q: quit editor"
|
---|
42 | (.) r: read in new file
|
---|
43 | (.,.) s: substitute
|
---|
44 | (1,$) v: like g, except select lines that do not match
|
---|
45 | (1,$) w: write out edited file
|
---|
46 | .fi
|
---|
47 | Many of the commands can take one or two addresses, as indicated above. The
|
---|
48 | defaults are shown in parentheses. Thus \fIa\fR appends to the current
|
---|
49 | line, and \fIg\fR works on the whole file as default.
|
---|
50 | The dot refers to the current line.
|
---|
51 | Below is a sample editing session with comments given following the # symbol.
|
---|
52 | .PP
|
---|
53 | .nf
|
---|
54 | .ta 0.5i 2.5i
|
---|
55 | ed prog.c # Edit prog.c
|
---|
56 | 3,20p # Print lines 3 through 20
|
---|
57 | /whole/ # Find next occurence of \fIwhole\fR
|
---|
58 | s/whole/while/ # Replace \fIwhole\fR by \fIwhile\fR
|
---|
59 | g/Buf/s//BUF/g # Replace \fIBuf\fR by \fIBUF\fR everywhere
|
---|
60 | w # Write the file back
|
---|
61 | q # Exit the editor
|
---|
62 | .fi
|
---|
63 | \fIEd\fR is provided for its sentimental value.
|
---|
64 | If you want a line-oriented editor, try \fIex\fR.
|
---|
65 | If you want a good editor, use \fIelle\fR, \fIelvis\fR, or \fImined\fR.
|
---|
66 | .SH "SEE ALSO"
|
---|
67 | .BR elvis (1),
|
---|
68 | .BR elle (9),
|
---|
69 | .BR mined (9).
|
---|