Skip to content

Instantly share code, notes, and snippets.

@Pitometsu
Forked from kates/search_and_replace.sh
Created October 30, 2015 00:08
Show Gist options
  • Save Pitometsu/895574c616cda1386433 to your computer and use it in GitHub Desktop.
Save Pitometsu/895574c616cda1386433 to your computer and use it in GitHub Desktop.
bulk search and replace with the silver searcher, awk, sed and xargs
ag "sometext" --nogroup | awk '{print substr($1,1,index($1,":")-1);}' | xargs -I {} sed -i .bak -e 's/sometext/anothertext/g' {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment