Skip to content

Instantly share code, notes, and snippets.

@flaviosilveira
Last active January 30, 2019 18:27
Show Gist options
  • Save flaviosilveira/09d996a733bd152a952373f15fbf184d to your computer and use it in GitHub Desktop.
Save flaviosilveira/09d996a733bd152a952373f15fbf184d to your computer and use it in GitHub Desktop.
Shell script to remove a specific line from files in a directory.
#!/bin/bash
for file in `grep -ril 'pattern-match' . | grep -v 'script'`
do
sed -i '/pattern-match/ d' $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment