Created
March 7, 2012 11:45
-
-
Save tskrynnyk/1992677 to your computer and use it in GitHub Desktop.
Grep through compressed archives
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 | |
[ "$#" -ne 2 ] && exit 1 | |
tar -tf "$2" | grep -v '/$' \ | |
| while read file | |
do tar -Ozxf "$2" "$file" | grep "$1" && echo $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment