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

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

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

Description: 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

Comment on (code) One-liner adds HTML breaks to text file
Download Code

Back to Snippets Section

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-08-23 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (173 votes), past polls