#!/usr/bin/perl open(PIPE, "-|", "lsusb", @ARGV) || die "popen $ARGV[0]: $!"; while () { if (/Bus (\d+) Device (\d+):/) { $path = `usbpath "$1/$2"`; chop $path; print "Path $path $_"; } else { print; } }