Came a across a little snippet online that I thought was quite neat:
lspci -v | awk '/VGA/,/^$/'
I usually use
grep, but sometimes, with multi-line output, you don't know how many lines to grab...

Looks like using
awk, the "
^$" looks for a "field delimiter", and the
/<PATTERN>/,/<PATTERN2>/ format (note the "comma" between the expressions) brings back everything from
<PATTERN> to
<PATTERN2> inclusive...
Example:
[root@core2pclinux ~]# lspci -v | awk '/VGA/,/^$/'
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03) (prog-if 00 [VGA controller])
Subsystem: Dell Device 01d4
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at eff00000 (32-bit, non-prefetchable) [size=512K]
I/O ports at eff8 [size=8]
Memory at d0000000 (32-bit, prefetchable) [size=256M]
Memory at efec0000 (32-bit, non-prefetchable) [size=256K]
Expansion ROM at <unassigned> [disabled]
Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit-
Capabilities: [d0] Power Management version 2
Kernel driver in use: i915
Kernel modules: i915, intelfb
And it even works across "records"!
For example:
[root@core2pclinux ~]# lspci -v | awk '/945/,/^$/'
00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)
Subsystem: Dell Device 01d4
Flags: bus master, fast devsel, latency 0
Capabilities: [e0] Vendor Specific Information: Len=09 <?>
Kernel driver in use: agpgart-intel
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03) (prog-if 00 [VGA controller])
Subsystem: Dell Device 01d4
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at eff00000 (32-bit, non-prefetchable) [size=512K]
I/O ports at eff8 [size=8]
Memory at d0000000 (32-bit, prefetchable) [size=256M]
Memory at efec0000 (32-bit, non-prefetchable) [size=256K]
Expansion ROM at <unassigned> [disabled]
Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit-
Capabilities: [d0] Power Management version 2
Kernel driver in use: i915
Kernel modules: i915, intelfb
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
Subsystem: Dell Device 01d4
Flags: bus master, fast devsel, latency 0
Memory at eff80000 (32-bit, non-prefetchable) [size=512K]
Capabilities: [d0] Power Management version 2
0c:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)
Subsystem: Intel Corporation Device 1020
Flags: bus master, fast devsel, latency 0, IRQ 26
Memory at efdff000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [c8] Power Management version 2
Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [e0] Express Legacy Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Device Serial Number 00-19-d2-ff-ff-6b-7d-ac
Kernel driver in use: iwl3945
Kernel modules: iwl3945
Looks like I'm going to have some quality time with
awk, some day!
