An alternative using tr (see Transliteration in Quote and Quote like Operators) to count the number of 'r's.
knoppix@Microknoppix:~$ perl -E ' > open my $fh, q{<}, \ <<EOD or die $!; > 0 a b h > 1 - r z > 3 u - u > 4 r x r > 5 r t r > 6 r r r > 7 r r r > 8 r r r > EOD > > while ( <$fh> ) > { > my( $seq, @cols ) = split; > print if tr{r}{} == scalar @cols; > }' 6 r r r 7 r r r 8 r r r knoppix@Microknoppix:~$
Cheers,
JohnGG
In reply to Re: Count similar characters in a row
by johngg
in thread Count similar characters in a row
by $new_guy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |