|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21571/root/usr/share/doc/ed-0.2/ |
Upload File : |
GNU ed(1) is not strictly POSIX compliant, as described in the
POSIX 1003.2-1992 document. The following is a summary of omissions
and extensions to, and deviations from, the POSIX standard.
OMISSIONS
---------
* Locale(3) is not supported yet.
EXTENSIONS
----------
* Though GNU ed is not a stream editor, it can be used to edit binary files.
To assist in binary editing, when a file containing at least one ASCII
NUL character is written, a newline is not appended if it did not
already contain one upon reading. In particular, reading /dev/null
prior to writing prevents appending a newline to a binary file.
For example, to create a file with GNU ed containing a single NUL character:
$ ed file
a
^@
.
r /dev/null
wq
Similarly, to remove a newline from the end of binary `file':
$ ed file
r /dev/null
wq
* BSD commands have been implemented wherever they do not conflict with
the POSIX standard. The BSD-ism's included are:
* `s' (i.e., s[n][rgp]*) to repeat a previous substitution,
* `W' for appending text to an existing file,
* `wq' for exiting after a write,
* `z' for scrolling through the buffer, and
* BSD line-addressing syntax (i.e., `^' and `%') is recognized.
* The POSIX interactive global commands `G' and `V' are extended to
support multiple commands, including `a', `i' and `c'. The command
format is the same as for the global commands `g' and `v', i.e., one
command per line with each line, except for the last, ending in a
backslash (\).
* The file commands `E', `e', `r', `W' and `w' process a <file>
argument for backslash escapes; i.e., any character preceded by a
backslash is interpreted literally. If the first unescaped character
of a <file> argument is a bang (!), then the rest of the line is
interpreted as a shell command, and no escape processing is performed
by GNU ed.
* For SunOS ed(1) compatibility, GNU ed runs in restricted mode if invoked
as red. This limits editing of files in the local directory only and
prohibits shell commands.
DEVIATIONS
----------
* For backwards compatibility, the POSIX rule that says a range of
addresses cannot be used where only a single address is expected has
been relaxed.
* To support the BSD `s' command (see EXTENSIONS above),
substitution patterns cannot be delimited by numbers or the characters
`r', `g' and `p'. In contrast, POSIX specifies any character expect
space or newline can used as a delimiter.
* Since the behavior of `u' (undo) within a `g' (global) command list is
not specified by POSIX, GNU ed follows the behavior of the SunOS ed:
undo forces a global command list to be executed only once, rather than
for each line matching a global pattern. In addtion, each instance of
`u' within a global command undoes all previous commands (including
undo's) in the command list. This seems the best way, since the
alternatives are either too complicated to implement or too confusing
to use.
* The `m' (move) command within a `g' command list also follows the SunOS
ed implementation: any moved lines are removed from the global command's
`active' list.
* If GNU ed is invoked with a name argument prefixed by a bang (!), then
the remainder of the argument is interpreted as a shell command. To invoke
ed on a file whose name starts with bang, prefix the name with a
(quoted) backslash.
* For backwards compatibility, errors in piped scripts do not force ed
to exit. POSIX only specifies ed's response for input via regular
files (including here documents) or tty's.