Skip to content

Instantly share code, notes, and snippets.

@tskrynnyk
Created March 7, 2012 11:45
Show Gist options
  • Save tskrynnyk/1992677 to your computer and use it in GitHub Desktop.
Save tskrynnyk/1992677 to your computer and use it in GitHub Desktop.
Grep through compressed archives
#! /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