#!/usr/bin/perl -w use strict; my $new_entry = -1; my $nr = 0; my ($id,$subvendor,$subdevice); my %data; my $cap=0; while (<>) { if (m/usbvision_device_data/) { $cap=1; next; } if (m/usbvision_table/) { $cap=0; next; } if ($cap==0) { next; } if (m/\{0x([0-9a-z]...)\s*\,\s*0x([0-9a-z]...).*\"(.*)\"/) { $data{$nr}->{nr} = $nr; $data{$nr}->{name} = $3; push @{$data{$nr}->{subid}}, "$1:$2"; $nr++; } } foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) { printf("%3d -> %-56s", $data{$item}->{nr}, $data{$item}->{name}); printf(" [%s]",join(",",@{$data{$item}->{subid}})) if defined($data{$item}->{subid}); print "\n"; }