Skip to content

Instantly share code, notes, and snippets.

@baudehlo
Last active August 29, 2015 14:01
Show Gist options
  • Save baudehlo/6e3e6a8ef6be8dce76c1 to your computer and use it in GitHub Desktop.
Save baudehlo/6e3e6a8ef6be8dce76c1 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
use strict;
open(my $grep, "-|", "grep", @ARGV) || die $!;
my %uuids;
while (<$grep>) {
if (/^[^\[]*\[(\w+)\]\s+\[([A-F0-9-]+)(?:\.\d+)?\]/) {
$uuids{$2}++;
}
}
if (! scalar(keys(%uuids))) {
print "Not found\n";
exit(-1);
}
print "Looking for UUIDs: ", join(', ',keys(%uuids)), "\n";
exec 'grep', '-E', '('.join('|',keys(%uuids)).')', $ARGV[-1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment