in reply to Re: count the number of occurrences of a pattern in a file
in thread count the number of occurrences of a pattern in a file
A very slight variation, not sure if yours is clearer in meaning than mine.
perl -nle '$count += () = /XY[0-9]+/g; END {print $count}' inputfile
Cheers,
JohnGG
|
|---|