in reply to Re^2: Nested greps w/ Perl
in thread Nested greps w/ Perl

grep -P 'Z' file_to_search | awk '{print $1}' | sort | uniq --count > uniq.count

One perlish equivalent is

perl -ae '$s{$F[0]}++ if $F[1] eq "Z"; END {print "$_ $s{$_}\n" for ke +ys %s}' file_to_search > uniq.count

See how the timings compare on your platform.


Edit: (TIMTOWTDI) s/The/One/