I want to use sed to replace every occurrence of /dir with $dir (replace / with $) in every script

Posted by gm on Stack Overflow See other posts from Stack Overflow or by gm
Published on 2010-03-01T18:44:32Z Indexed on 2010/05/26 8:11 UTC
Read the original article Hit count: 209

Filed under:

use sed to replace every occurrence of /dir with $dir (replace / with $) in every script in a directory.

sed "s#/dir#$dir#g"

The $ keeps being interpreted as a function or variable call. Is there a way around this?

thanks

© Stack Overflow or respective owner

Related posts about sed