Replace dollar sign with sed

Viewed 22190

I try to replace all dollar signs in a string using sed. However, not only the dollar sign gets replaced but the whole string that follows.

$ echo "abc $def ghi" | sed 's/$//g'
$ abc ghi

If at least one number is following the dollar sign only the part before the first non-number gets replaced:

$ echo "abc $123def ghi" | sed 's/$//g'
$ abc def ghi

What is going on?

3 Answers
Related