in reply to splitting lspci output
What do you actually want to achieve? Show us an example of the result you require because our mind reading units tend to be a bit flakey and don't always let us know what it is that you want.
It may be that you want this:
use strict; use warnings; while (<DATA>) { chomp; next if ! length; my ($section, $device, $culprit, $rev) = m/(\S+)\s+ ([^:]+):\s+ ((?:(?!\s*\(rev).)+)\s* (.*)/x; next if ! defined $rev; print "$section, $device, $culprit, $rev\n"; } __DATA__ 00:1f.3 SMBus: Intel Corporation 82801BA/BAM SMBus (rev 12) 00:1f.4 USB Controller: Intel Corporation 82801BA/BAM USB (Hub #2) (re +v 12) 00:1f.5 Multimedia audio controller: Intel Corporation 82801BA/BAM AC' +97 Audio (rev 12)
Prints:
00:1f.3, SMBus, Intel Corporation 82801BA/BAM SMBus, (rev 12) 00:1f.4, USB Controller, Intel Corporation 82801BA/BAM USB (Hub #2), ( +rev 12) 00:1f.5, Multimedia audio controller, Intel Corporation 82801BA/BAM AC +'97 Audio, (rev 12)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: splitting lspci output
by Anonymous Monk on May 18, 2006 at 04:02 UTC | |
by GrandFather (Saint) on May 18, 2006 at 04:17 UTC | |
by HuckinFappy (Pilgrim) on May 18, 2006 at 05:54 UTC |