HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)

e
ed(1) ed(1)
current line address is unchanged.
(.+1) newline An address alone on a line causes the addressed line to be printed. A newline alone is
equivalent to .+1p. This technique is useful for stepping forward through the buffer.
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
For information about the UNIX standard environment, see standards(5).
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 le. 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.
If a file contains lines longer than the specified limit (eg., 4096 characters), the longer lines will be trun-
cated to the stated maximum length. Saving the file will write the truncated version over the original file,
thus overwriting the original lines completely.
HP-UX 11i Version 3: February 2007 6 Hewlett-Packard Company 253