Created
November 24, 2022 07:11
-
-
Save foemre/8d1c9b1f506e780ddf665d664e2be02b to your computer and use it in GitHub Desktop.
find text files that contain a regex pattern, extract the file basename, remove all files with that basename
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
grep -rw *.txt -e "^77" | cut -d'.' --complement -f2- | awk '!seen[$0]++' | while read line; do rm "$line".*; done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment