in reply to Parsing a Flat File and counting occurances of numbers?
The following one-liner would do it. (Wrapped for posting. Quotes are shell dependant.)
perl -nwle"/bn(\d{4})/ && $1 >= 4000 && $1 <=6200 && ++$c{ $1 };" -e"END{ print qq[$_ => $c{ $_ }] for sort keys %c}" temp.dat 4370 => 1 4512 => 1 5600 => 2 6042 => 1 6085 => 2
|
|---|