Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: text parsing question

by snopal (Pilgrim)
on Oct 01, 2007 at 14:14 UTC ( #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
Node Status?
node history
Node Type: note [id://641893]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2020-10-28 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (264 votes). Check out past polls.

    Notices?