16 Apr

Passing bash variable to sed

If  you need to pass some variable from bash to sed use double quotes:

sed -i "s/$var/replace/g" "$file"

Easy.



Leave a Reply

Your email address will not be published. Required fields are marked *