Apologize if you feel this question very basic. Anyways, I am typing
sed '/[iI]t/ a\\ Found it!' data
but it says the error event not found.
I tried escaping that !
with backslash \!
but it doesn't work.
I don't understand when backslash \
can escape a character and use it literally then why doesn't it work in sed?
Which OS did you try it on? On HP-UX 8.11 csh there are 2 ways to cancel the speacial meaning of exclamation mark for history substitutions (see History substitutions in man csh).
Put space after ! (couple of other characters work too)
sed '/[iI]t/ a\\
Found it! ' data
Escape it via \!
sed '/[iI]t/ a\\
Found it\!' data
This actually also works with double quotes:
sed "/[iI]t/ a\\
Found it\!" data
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments