Skip to content

Instantly share code, notes, and snippets.

@viniciusban
Last active December 24, 2015 10:39
Show Gist options
  • Save viniciusban/6785368 to your computer and use it in GitHub Desktop.
Save viniciusban/6785368 to your computer and use it in GitHub Desktop.
Makes a recursive sed in place substitution.
#!/usr/bin/env bash
# Makes sed a recursive in place substitution and
# create backup of original files with .bkp extension.
old=$1
new=$2
sed -i.bkp "s/${old}/${new}/g" $(grep -ril "${old}" .)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment