Skip to content

Instantly share code, notes, and snippets.

@janosgyerik
Created December 16, 2013 19:17
Show Gist options
  • Select an option

  • Save janosgyerik/7992671 to your computer and use it in GitHub Desktop.

Select an option

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
#!/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
@mpothireddy
Copy link

I get permission denied when i execute this script

@janosgyerik
Copy link
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