in reply to Parsing a Flat File and counting occurances of numbers?
perl -wne ' $h{$1}++ if /bn(\d{4}),/ }{$,="\t"; print %h, "\n" ' datafile [download]
perl -MO=Deparse -wne ' $h{$1}++ if /bn(\d{4}),/ }{$,="\t"; print %h, "\n" ' [download]