On Mon, 28 Jan 2002 15:02:31 -0800, David Palomino wrote: > I am trying to parse lpstat -s output from HPUX. There are two lines > per "record". It looks like this:
Playing with the $/ might help you a bit here #!/usr/bin/perl -w use strict; $/ = 'device for'; my $header = <DATA>; while (<DATA>){ my ($dev1,$remote,$on) = / ([^:]+):.*?to: (.*) on (\w+)/s; print "$dev1,$remote,$on\n"; } __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__ -- briac << dynamic .sig on strike, we apologize for the inconvenience >> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]