It is because 0x24
is the hex code for the $
character. Note that ^
and $
have special meaning in regex (which sed
uses for matching), and literally means "at the beginning of the line", and "at the end of the line", respectively. As such, those characters are ignored unless escaped. Therefore,
echo "this and that" | sed 's/this$/cat/'
will leave the string unchanged because it you're telling sed to look for 'this' at the end of the line -- since 'that' is at the end, it doesn't match. However,
echo "It costs $50.00." | sed 's/\$50\.00/47.00 Swiss Francs/'
Will change the line as expected because the $
was escaped. For binary data, just include the hex code for the \
character (\x5c
) just prior to \x24
in the regex section, and it should work just fine.
Cheers.