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/
In reply to Re^3: Nested greps w/ Perl
by hippo
in thread Nested greps w/ Perl
by wackattack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |