Re: [OT] get all devices from a vendor from pci.ids
Hello,
On Thu, Jan 5, 2017 at 6:00 PM, Floris <jkfloris@dds.nl> wrote:
> Op Wed, 04 Jan 2017 17:27:55 +0100 schreef Floris <jkfloris@dds.nl>:
>
>
>> (Not really a Debian question, but I know there are smart people on this
>> list.)
>>
>> I want to search the pci.ids file (from the pciutils package) for all
>> Compaq devices.
>> Pci ID's 0e11:xxxx , 1032:xxxx and 10da:xxxx matches Compaq.
>> Unfortunately, only at a beginning of a list the id of the vendor is printed
>> in column 1. The id of the devices are printed in column 2, with an empty
>> first column.
>>
>> (part of pci.ids)
>> ...
>> 0e11 Compaq Computer Corporation
>> 0001 PCI to EISA Bridge
>> 0002 PCI to ISA Bridge
>> 0046 Smart Array 64xx
>> 0e11 4091 Smart Array 6i
>> 0e11 409a Smart Array 641
>> 0e11 409b Smart Array 642
>> 0e11 409c Smart Array 6400
>> 0e11 409d Smart Array 6400 EM
>> 0049 NC7132 Gigabit Upgrade Module
>> 004a NC6136 Gigabit Server Adapter
>> ...
>> c000 Remote Insight Lights-Out Edition
>> f130 NetFlex-3/P ThunderLAN 1.0
>> f150 NetFlex-3/P ThunderLAN 2.3
>> 0e55 HaSoTec GmbH
>> ...
>>
>> Is there an awk, grep and or sed solution?
>>
>> Floris
>>
>
> an other solution would be something like:
>
> # cat pci.ids | {magic-command} 0e11:004a
> NC6136 Gigabit Server Adapter
>
> what is the magic command?
Using perl:
perl -ne 'print if (/^0e11/.../^\S/) and (/^\s/) or (/^0e11/);'
/usr/share/misc/pci.ids
Reply to: