Skip to content

Instantly share code, notes, and snippets.

@torpedoallen
Created May 25, 2017 10:00
Show Gist options
  • Save torpedoallen/deb7e7958165a732b9903333b383eb3a to your computer and use it in GitHub Desktop.
Save torpedoallen/deb7e7958165a732b9903333b383eb3a to your computer and use it in GitHub Desktop.
#!/bin/bash
# author: torpedoallen
# usage: grep and remove lines
# how-to: put the file into your PATH like /usr/local/bin and make it executable.
if [ -z "$2" ]; then git grep -zl "$1" | xargs -0 sed -i "/$1/d"; else git grep -zl "$1" -- $2 | xargs -0 sed -i "/$1/d"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment