Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: Removing the carriage return in a Find & Replace?

by mscharrer (Hermit)
on Sep 26, 2008 at 13:51 UTC ( [id://713877]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Removing the carriage return in a Find & Replace?
in thread Removing the carriage return in a Find & Replace?

The -p option you use splits the input in separate lines. For Perl \n isn't the same as a space even if it is for HTML. One solution is to undef $/ in order to enable ''slurp mode'', (or to use the before mentioned command line option -0):

perl -i -pe 'BEGIN { undef $/ } s/<TD>\s*<FONT\s+FACE=arial\s+SIZE=-1> +/widget/g' test.html

Replies are listed 'Best First'.
Re^5: Removing the carriage return in a Find & Replace?
by bobafifi (Beadle) on Sep 30, 2008 at 16:03 UTC
    How can I use this to batch edit multiple pages? For some reason, I can only edit one page at a time.

    Thanks!
    -Bob

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found