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 ®le 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 variable is null or not set, the POSIX shell, /usr/bin/sh , is used (see sh-posix(1)).

When set, TMPDIR speci®es a directory to be used for temporary ®les, 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 classi®cation 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: expecting `w', then continues normal editing unless you enter a second e or q command, in which case the second command is executed. The -sor - command-line option inhibits this feature.

EXAMPLES

Make a simple substitution in file-1from a shell script, changing the ®rst 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/

wfile-2

q

EOF

Note that, if a command fails, the editor exits immediately.

WARNINGS

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)).

If the editor input is coming from a command ®le (e.g., ed file < ed-cmd-file) , the editor exits at the ®rst failure of a command in the command ®le.

Section 1200

− 6 −

HP-UX Release 11i: December 2000