Skip to content

Instantly share code, notes, and snippets.

@dpwright
Created April 17, 2012 00:46
Show Gist options
  • Save dpwright/2402616 to your computer and use it in GitHub Desktop.
Save dpwright/2402616 to your computer and use it in GitHub Desktop.
Selectively deleting any instance of LINE from files matching SEARCH using sed
grep -Rl "SEARCH" . | while read FILE; do sed -i "" "/LINE/d" $FILE; done
grep -Rl "SEARCH" . | while read FILE; do sed "/LINE/d" $FILE > tmp; mv tmp $FILE ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment