Dear Perl Gurus,

Still struggling here...
The problem is the data in the middle of the match is on multiple lines.
Please reply directly and CC the list.
Thanks,
D.G.
(kora musician / audiophile / webmaster @ www.coraconnection.com  / Ft. Worth, 
TX, USA)
>>
I am having a little trouble understanding matching and getting the sub pattern 
saved to a Var. so that I can do a munge. I want to take the line returns and 
change them into 
pipe characters '|'   
All data records start with a date i.e. 01/01/2006  
But there are fields in between that are one multiple lines. Sample data is 
below the script.

Here's what I have so far....  Revised sill not working!

#!/usr/bin/perl -w


open(FI,"test.txt") || die "Read in, Could not find File, $!";
my @files = <FI>;
close(FI);

for (@files){

chomp($_);

#!/usr/bin/perl -w

open(FI,"test.txt") || die "Read in, Could not find File, $!";
my @files = <FI>;
close(FI);

for (@files){

chomp($_);

@match = ($_ =~ m!(\d+\/\d+\/\d+)(.+?)(?=\d+/\d+/\d+)!);

$match[1]=~tr/\n/|/;

print "$match[0]$match[1]\n";
print "#"x10, "#"; 
#rename($old,$_);
}


# save out modified result...
}

Given this data:

09/01/2006|03:29AM Password for qsocordovam reset by Self Reset utility 
Username: qsocordovam 
ClientNumber: 77927 
IP address: 24.248.1.241  
09/01/2006|07:53AM Failed reset attempt 
Username: tmpcollic03 
ClientNumber: 110330 
IP address: 152.121.16.7 
Failed challenge question(s)  
09/01/2006|07:55AM Failed reset attempt 
Username: tmpcollic03 
ClientNumber: 110330 
IP address: 152.121.16.7 
Failed challenge question(s)  
09/01/2006|08:03AM Failed reset attempt 

Desired result: 
09/01/2006|03:29AM Password for qsocordovam reset by Self Reset 
utility|Username: qsocordovam|ClientNumber: 77927|IP address: 24.248.1.241  
#Next record.... starts with a date of format : 09/01/2006


__END__



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to