Created
December 16, 2013 19:17
-
-
Save janosgyerik/7992671 to your computer and use it in GitHub Desktop.
Find a pattern in all zip files in the current directory and print a report with the number of matches, the answer for:
http://stackoverflow.com/questions/20618515/how-to-find-a-pattern-in-text-files-within-zip-files-and-print-the-number-of-mat
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 -e | |
| pattern=$1 | |
| for zip in *.zip; do | |
| while IFS=: read fn count; do | |
| echo Zip File : $zip has text file : $fn has $pattern $count times | |
| done < <(zipgrep -c "$1" "$zip" | grep -v :0) | |
| done |
Author
Did you make the script executable?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get permission denied when i execute this script