Skip to content

Instantly share code, notes, and snippets.

@yichao0319
Created October 29, 2013 00:00
Show Gist options
  • Save yichao0319/7206979 to your computer and use it in GitHub Desktop.
Save yichao0319/7206979 to your computer and use it in GitHub Desktop.
bash:escape sed
sed "s/XXX/$(echo ${replace} | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/&/\\\&/g')/g" mother.file > output.file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment