ls I/{some,dirs}/ | xargs -n 1 -t I/foo/bar -q 2>&1 | sed -e 's/stuffToRemove//' -e '/linesToIgnore/d' | less #### find I -type f | perl -nle 'open my $fh, "I/foo/bar -q $_ |" or next; chomp(my $l = <$fh>); $l =~ s/stuffToRemove//; my $count =()= $l =~ /stuffToCount/g; print "$_:$count[$l]" if $count > 2'