Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Count similar characters in a row

by suhailck (Friar)
on Oct 06, 2010 at 15:26 UTC ( #863816=note: print w/ replies, xml ) Need Help??


in reply to Count similar characters in a row

Try this,

perl -wle 'while(<>) { $count++ if "rrr" eq join "",(split)[1 .. 3] }; print $count' my_column_file.txt 3


Comment on Re: Count similar characters in a row
Download Code
Re^2: Count similar characters in a row
by jwkrahn (Monsignor) on Oct 06, 2010 at 16:00 UTC
    perl -lane '$count++ if "rrr" eq join "",@F[1 .. 3] }{ print $count' m +y_column_file.txt

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863816]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2014-07-23 18:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (149 votes), past polls