Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Remove newlines and join lines

by BrowserUk (Patriarch)
on Aug 28, 2002 at 19:24 UTC ( [id://193548]=note: print w/replies, xml ) Need Help??


in reply to Re: Remove newlines and join lines
in thread Remove newlines and join lines

Effectively what you want to do is remove any blank lines and then join every second remaining to it's predecessor. So... (untested)

#open INPUT and OUTPUT while (<INPUT>) { chomp; next if m/^\s+$/; my $nextline; chomp($nextline = <INPUT> ) while $nextline !~ m/^\s+/; print OUTPUT $_,' ',$nextline; } #close INPUT and OUTPUT

What's this about a "crooked mitre"? I'm good at woodwork!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-25 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found