The backslash works fine. echo '*.cpp' | sed 's/\*//' echo '*.cpp' | sed 's/\*//' => .cpp
If you are in a shell, you may need to double escape $ , as this is a special character for both the shell (variable extension) and sed (end of line)
echo '$.cpp' | sed "s/\\$//" echo '$.cpp' | sed "s/\\$//" or echo '$.cpp' | sed 's/\$//' echo '$.cpp' | sed 's/\$//' => '.cpp'
Do not run away ( or ) ; which actually makes them special (groups) in sed. Some other common characters include [ ] \ . ?
Here's how to avoid your example:
sed 's/ASD = \$start ( \*\.cpp )/ASD = $dsadad ( .cpp )/' somefile
sapht source share