depperm depperm - 6 months ago 57
Linux Question

Appending to file, sed unterminated address regex

I'm trying to append to the end of a file, using the style from this answer but I get the error:

sed: -e expression #1, char 16: unterminated address regex

the command (I've also tried without the
and same error):

sed -i -e '\$ahaha_value=26' example.txt

where I'm expecting
to get the end of the file and
to append.

I've looked at these questions here, here, and here. The issues there seem to be regex based and I don't see the issue with my regex.


With single quotes you don't need to escape $ sign since it's not going to be evaluated by shell.


 sed -e '$a...'


sed -e "\$a..."