Skip to content

Instantly share code, notes, and snippets.

@sforteln
Created July 6, 2012 04:16
Show Gist options
  • Save sforteln/3058039 to your computer and use it in GitHub Desktop.
Save sforteln/3058039 to your computer and use it in GitHub Desktop.
function searchManifests() { for jarFile in \`ls $1/\*jar\`; do echo $jarFile;
unzip -p $jarFile META-INF/MANIFEST.MF | perl -e 'while(){
if($\_ =\~ /$ARGV[0]:\\s([\^\\s]\*)\\s/){print " " . $1 . "\\n";exit;}}
print " no match \\n";' $2; done }
{% endhighlight %}
Or a bit more readable
{% highlight bash %}
function searchManifests() {
for jarFile in \`ls $1/\*jar\`;
do echo $jarFile; unzip -p $jarFile META-INF/MANIFEST.MF |
perl -e '
while(){
if($\_ =\~ /$ARGV[0]:\\s([\^\\s]\*)\\s/){
print " " .$1 . "\\n"; exit;
}
}
print " no match \\n"; ' $2; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment