home *** CD-ROM | disk | FTP | other *** search
- .im man.im
- .NM ted edit text files
- .SY ted [file]
- .FU
- .ital ted
- is an interactive text editor that reads command lines from its input
- and writes display information, upon command, to its output.
- It works by reading text files on command into an internal `buffer'
- (which may be quite large), displaying and modifying the buffer contents
- by other commands, then writing all or part of the buffer to text files,
- also on command.
- The buffer is organized as a sequence of lines, numbered from 1;
- lines are implicitly renumbered as text is added or deleted.
-
- Context searches and substitutions are specified by writing text patterns,
- following the same rules for building patterns as used by
- .ital findp.
- Substitutions specify replacement text following the same rules as used
- by the program
- .ital change.
-
- Line numbers are formed from the following components:
- .Q1
- n a decimal number
- \. the current line ("dot")
- $ the last line
- /pattern/ a forward context search
- \\pattern\\ a backward context search
- .Q2
- Components may be combined with
- .ital +
- or
- .ital -,
- as in, for example,
- .Q1
- \.+1 sum of . and 1
- $-5 five lines before $
- .Q2
- Line numbers are separated by commas or semicolons;
- a semicolon sets the current line to the most recent line number
- before proceeding.
-
- Commands may be preceded by an arbitrary number of line numbers
- (except for
- .ital e,
- .ital f
- and
- .ital q,
- which require that none be present).
- The last one or two are used as needed.
- If two line numbers are needed and only one is specified,
- it is used for both.
- If no line numbers are specified, a default rule is applied:
- .Q1
- (.) use the current line
- (.+1) use the next line
- (.,.) use the current line for both line numbers
- (1,$) use all lines
- .Q2
- In alphabetical order, the commands and their default line numbers are:
- .Q1
- (.) a append text after line (text follows)
- (.,.) c change text (text follows)
- (.,.) dp delete text
- e file edit "file" after discarding all previous text,
- remember file name
- f file print file name, remember file name
- (.) i insert text before line (text follows)
- (.,.) m line3 p move text to after "line3"
- (.,.) p print text
- q quit
- (.) r file read "file", appending after line
- (.,.) s/pat/new/gp substitute "new" for occurrence of "pat"
- (g implies for each occurrence across line)
- (1,$) w file write "file" (leaves current state unaltered)
- (.) =p print line number
- (.+1) NEWLINE print one line
- .Q2
- The trailing
- .ital p,
- which is optional, causes the last affected line to be printed.
- Dot is set to the last affected line, except for
- .ital f,
- .ital w,
- and
- .ital =,
- for which it is unchanged.
-
- Text entered with
- .ital a,
- .ital c
- and
- .ital i
- is terminated with a line containing just a
- .ital `.'.
-
- The global prefixes cause repeated execution of a command, once for
- each line that matches
- .ital (g)
- or does not match
- .ital (x)
- a specified text pattern:
- .Q1
- (1,$) g/pattern/command
- (1,$) x/pattern/command
- .Q2
- .sf 6
- command
- .sf 0
- can be anything but
- .ital a,
- .ital c,
- .ital i
- or
- .ital q,
- and may be preceded by line numbers as usual.
- Dot is set to the matched line before
- .sf 6
- command
- .sf 0
- is done.
-
- If the command line argument
- .ital file
- is present,
- then the editor behaves as if its input began with the command
- .ital "e file".
- The first filename used is remembered, so that a subsequent
- .ital e,
- .ital f,
- .ital r,
- or
- .ital w
- command can be written with no filename to refer to the remembered filename.
- A filename given with
- .ital e
- or
- .ital f
- replaces any remembered filename.