in reply to Re: find a string and count of its occurence in a text file
in thread find a string and count of its occurence in a text file

And to chuck in an (incredibly primitive) idea for a line count as well:
_data.txt_ abc:AB CD:100 def:DE FG:101 ghi:GH IJ:102 abc:AB CD:100 ghi:GH IJ:103 my $count; while ( <FILE> ) { print if /^abc:/; $count++ if /^abc/; } print "Matched $count times\n"; _output_ abc:AB CD:100 abc:AB CD:100 Matched 2 times
Update: I'm silly; added condition for incrementing $count.