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)
In reply to Re: splitting lspci output
by GrandFather
in thread splitting lspci output
by rimmern
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |