Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Remove newlines and join lines

by Django (Pilgrim)
on Aug 28, 2002 at 14:43 UTC ( [id://193473]=note: print w/replies, xml ) Need Help??


in reply to Remove newlines and join lines

Indeed there are many ways... so here's mine:
#!usr/bin/perl open ROWS, "< style.txt" or die "Can't read from style.txt"; undef $/; # no input record separator $_ = <ROWS>; # copy the whole file to default var close ROWS; s/\s*(\w+)[\n\s]+([-.\d]+)[\n\s]+/$1 $2\n/g; # substitute your described input format # with requested output format in the whole text (now $_) open E, "> style1.txt" or die "Can't write in style1.txt"; print E; close E;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-19 05:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found