Hello, I am trying to parse lpstat -s output from HPUX. There are two lines per "record". It looks like this:
------ begin sample raw data --------- no system default destination device for ms331x_lzr: /dev/null remote to: ms331x-lzr on spooler1 device for df447x_lzr: /dev/null remote to: df447x-lzr on spooler2 device for cvacct4_lzr: /dev/null remote to: cvacct4-lzr on spooler3 device for myprinter: /dev/null remote to: cvacct5-lzr on spooler3 ------- end sample raw data ------- As an end result, I would like to get comma-separated output something like this: ms331x_lzr,ms331x-lzr,spooler1 df447x_lzr,df447x-lzr,spooler2 cvacct4_lzr,cvacct4-lzr,spooler3 myprinter,cvacct5-lzr,spooler3 Here is the code that I have been wrestling with: $/=' '; open (INPFILE,"/path/to/lpstat.out") || die "Can't open /path/to/lpstat.out \n"; while ($record=<INPFILE>) { $record =~ /\Adevice\s+for\s+(\w[-_]?\w?):\s+.*\n\s+remote\s+to:\s+(\w[-_]?\w?)\s+on\s+ (\w)$\Z/sm; print "$1,$2,$3\n"; } Am I way off base? Thanks! Dave Palomino Lockheed Martin ES-US UNIX Engineering & Support [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]