5.11. My script aborts with an error message, "event not found".
This error is generated by the csh or tcsh shells, not by sed. The
exclamation mark (!) is special to csh/tcsh, and if you use it in
command-line or shell scripts--even within single quotes--it must
be preceded by a backslash. Thus, under the csh/tcsh shell:
sed '/regex/!d' # will fail
sed '/regex/\!d' # will succeed
The exclamation mark should not be prefixed with a backslash when
the script is called from a file, as "-f script.file".