I am trying to understand the answer on Return code of sed for no match, but it dos not make any sense the expression sed '/foo/{s/f/b/;q}; /foo/!{q100}'. He could just not create a simple example? Why these so many slashes /, semicolons ; and extra pair of /foo/.
I am trying to replace the tr by foo and make sed have the return code $? of 100 when its succeeds the operation. I tried this code and does not work.
echo "trash"|sed 's/tr/foo/!{q100}'; echo $?
Output is:
sed: -e expression #1, char 10: unknown option to `s'
1
How can I pass correctly the parameter q with value 100 to my sed expression?