Created
September 6, 2018 14:30
-
-
Save mkrogemann/a649357ba7089c4b01d88bcde67fedd5 to your computer and use it in GitHub Desktop.
This little shell script will walk through a directory hierarchy, find given text in matching files and remove the whole line in which the text appears
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for thefile in `find <path to start from> -type f -name <filename pattern>` ; do | |
| grep -v "<text to be removed (affects whole line)>" $thefile > $thefile.$$.tmp | |
| mv $thefile.$$.tmp $thefile | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment