Link to home
Start Free TrialLog in
Avatar of jl66
jl66Flag for United States of America

asked on

Request a perl one-liner to count matched patterns in a file

Request a perl to count matched patterns in a file. Is one-liner possible? The environment is ms windows. For example,
in test.txt,

aa bb 12 32 24 bc d1 ff f0 cc
24 bc d1 99 0f cd ab db ea 12
12 23 34 45 54 55 21 78 34 89
cd ae de ef ca cb da 24 bc d1
cd 24 bc d1 24 bc d1 ca cb da
.....

Want to count how many pattern "24 bc d1" in this file. Not need to consider the overlapped case such as the line 12 12 12 12 if the matched pattern is "12 12 12".
SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jl66

ASKER

Thanks a lot for the solution.