And what output would you want in those cases? The text '(none)' where the date should be?
#! perl -slw use strict; while( <DATA> ) { $_ .= <DATA>; print join',', m[ Username: \s+ (\S+) \s+ Owner: \s+ ([^\n]+ ) \n Last\sLogin: \s+ ( .+ ) \s \( [^,]+, \s+ (.+) \s\( ]x; } __DATA__ Username: JANDERSON Owner: JOE ANDERSON Last Login: 14-JAN-2002 08:14 (interactive), 4-MAR-2002 17:09 (non-in +teractive) Username: PBARRETT Owner: PAUL BARRETT Last Login: 18-JAN-2006 08:14 (interactive), 24-MAR-2005 17:09 (non-i +nteractive) Username: LARRY Owner: LARRY FINE Last Login: (none) (interactive), (none) (non-in +teractive) Username: MOE Owner: HARRY MOSES HOWARD Last Login: 11-JUL-2002 18:08 (interactive), (none) (non-in +teractive) Username: CURLY Owner: JEROME HOWARD Last Login: (none) (interactive), 12-SEP-1997 11:33 (non-in +teractive)
Gives
P:\test>junk JANDERSON,JOE ANDERSON,14-JAN-2002 08:14,4-MAR-2002 17:09 PBARRETT,PAUL BARRETT,18-JAN-2006 08:14,24-MAR-2005 17:09 LARRY,LARRY FINE,(none),(none) MOE,HARRY MOSES HOWARD,11-JUL-2002 18:08,(none) CURLY,JEROME HOWARD,(none),12-SEP-1997 11:33
In reply to Re^3: Parsing Text into CSV
by BrowserUk
in thread Parsing Text into CSV
by bowei_99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |