If you are concerned with only filtering output of lshw to show device and its corresponding driver, you can use the lshw and awk combination bellow:
sudo lshw | awk '/product:/{ if(length(PROD) > 0){PROD=""}; for(i=1;i<=NF;i++) PROD=PROD" "$i } /driver=/{ for(j=1;j<=NF;j++){ if($j~/driver=/) DRIVER=$j };print "---",PROD,DRIVER; PROD=""}'
Basic idea here is that we find lines that have "product: . . . " in them and store into PROD. Because some devices don't list drivers, we could have repeatedly appended line after line to PROD variable, so in the beginning we check length of the PROD string. Another matching that is going on, is for the lines containing the driver= part. Once we have that, we print both the product and the driver information.
Bellow is the command put together into a script, and sample output:
$ cat ./dev-drivers.sh
#!/bin/bash
sudo lshw | awk '/product:/{ if(length(PROD) > 0){PROD=""};\
for(i=1;i<=NF;i++) PROD=PROD" "$i }\
/driver=/{ for(j=1;j<=NF;j++){ if($j~/driver=/) DRIVER=$j };\
print "---",PROD,DRIVER; PROD=""}'
$ ./dev-drivers.sh
[sudo] password for xieerqi:
--- product: ValleyView SSA-CUnit driver=iosf_mbi_pci
--- product: ValleyView Gen7 driver=i915
--- product: ValleyView 6-Port SATA AHCI Controller driver=ahci
--- product: ValleyView USB xHCI Host Controller driver=xhci_hcd
--- product: ValleyView SEC driver=mei_txe
--- product: ValleyView High Definition Audio Controller driver=snd_hda_intel
--- product: ValleyView PCI Express Root Port driver=pcieport
--- product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller driver=r8169
--- product: ValleyView PCI Express Root Port driver=pcieport
--- product: QCA9565 / AR9565 Wireless Network Adapter driver=ath9k
--- product: ValleyView PCI Express Root Port driver=pcieport
--- product: RTS5229 PCI Express Card Reader driver=rtsx_pci
--- product: ValleyView Power Control Unit driver=lpc_ich