Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

(code) One-liner adds HTML breaks to text file

by ybiC (Prior)
on Dec 17, 2001 at 02:26 UTC ( [id://132406]=CUFP: print w/replies, xml ) Need Help??

Perl one-liner to add HTML break to each line of a text file.   Single quotes shown are for *nix, use double quotes for Win32.

Thanks to monks (I forget who) who helped me in the CB months ago on this.   With grinder's Perl Monks Snippets Index now active at jcwren's perlmonk.org host, this seems worth posting.



perl -pe 's/^(?!(<p>|<br>))/<br>/gi;' < original_file > new_file

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://132406]
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-24 18:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found