Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: text parsing question

by snopal (Pilgrim)
on Oct 01, 2007 at 14:14 UTC ( [id://641893]=note: print w/replies, xml ) Need Help??


in reply to text parsing question

This may not be optimal for your situation, but it is possible to change your linebreak value to something more suitable to your needs;

#Untested { # localize the block local $/ = q{ } # space character is the new newline my $fh; unless (open $fh, "<".$logfile_name) { die ("File open failure\n\t$!\n"); } my $buffer; while (<$fh>) { next if /\n/; if (/^\d\d:\d\d:\d\d/) { print $buffer." "; $buffer = $_; } else { $buffer .= $_." "; } print $buffer; close $fh; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://641893]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-24 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found