HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)

e
ed(1) ed(1)
If an interrupt signal (ASCII DEL or BREAK) is sent,
ed prints a ? and returns to its command level.
The following size limitations apply: 256 characters per global command list, 64 characters per file name,
and 32 MB characters in the buffer. The limit on the number of lines depends on the amount of user
memory: each line takes 1 word.
EXTERNAL INFLUENCES
Environment Variables
SHELL determines the preferred command-line interpreter for use in all
!-style commands. If this vari-
able is null or not set, the POSIX shell,
/usr/bin/sh , is used (see sh-posix(1)).
When set,
TMPDIR specifies a directory to be used for temporary files, overriding the default directory,
/tmp.
LANG provides a default value for internationalization variables that are unset or null. If
LANG is unset or
null, the default value is "C" (see lang(5)). If any internationalization variable contains an invalid setting,
all internationalization variables default to "C". See environ(5).
If
LC_ALL is set to a nonempty string value, it overrides the values of all the other internationalization
variables, including LANG.
LC_CTYPE determines the interpretation of text as single- and/or multibyte characters, the classification
of characters as printable, and the characters matched by character class expressions in regular expres-
sions.
LC_MESSAGES determines the locale that should be used to affect the format and contents of diagnostic
messages written to standard error and informative messages written to standard output.
NLSPATH determines the location of message catalogues for the processing of LC_MESSAGES .
International Code Set Support
Single- and multibyte character code sets are supported.
DIAGNOSTICS
? Command error. Use h or H to get a detailed explanation.
?file Inaccessible file. Use h or H to get a detailed explanation.
If changes have been made in the buffer since the last w command that wrote the entire buffer,
ed warns
you if you attempt to destroy the buffer with an
e or q command. ed
displays ? or warning: expect-
ing ‘w’
, then continues normal editing unless you enter a second e or q command, in which case the
second command is executed. The
-s or - command-line option inhibits this feature.
EXAMPLES
Make a simple substitution in file-1 from a shell script, changing the first occurrence of abc
in any line
to
xyz, and save the changes in file-2.
cat - << EOF | ed -s file-1
1,$ s/abc/xyz/
w file-2
q
EOF
Note that, if a command fails, the editor exits immediately.
WARNINGS
ed(1) allows a Maximum Line Length of 4096 characters. Attempting to create lines longer than
the allowable limit causes ed(1) to produce a Line too long error message.
A ! command cannot be subject to a g or a v command.
The ! command and the ! escape from the e, r, and w commands cannot be used if the the editor is
invoked from a restricted shell (see sh(1)).
The sequence \n in a regular expression does not match a newline character.
The l command does not handle DEL correctly.
Files encrypted directly with the crypt command with the null key cannot be edited (see crypt(1)).
Section 1208 Hewlett-Packard Company 6 HP-UX 11i Version 1: September 2005