Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: newlines for windows from unix

by jeroenes (Priest)
on Jun 07, 2001 at 17:12 UTC ( #86538=note: print w/ replies, xml ) Need Help??


in reply to newlines for windows from unix

Run your files through:

perl -i.bak -pe 'chomp; $_.="\r\n";'
Jeroen
"We are not alone"(FZ)


Comment on Re: newlines for windows from unix
Download Code
Re: Re: newlines for windows from unix
by ChemBoy (Priest) on Jun 20, 2001 at 21:11 UTC

    My favorite switch is -l, and this is why:
    perl -i.bak -ple 'BEGIN{$/="\n"}'
    gets you from Unix to DOS (or should) and changing "\n" to "\r\n" gets you back.

    Update: assuming you're always converting to the system you run the command on, that is--the -l flag gives you native line-endings.

    Though of course if you're in MSDOS, you presumably need to fiddle with the quotes some.



    If God had meant us to fly, he would *never* have give us the railroads.
        --Michael Flanders

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-12-29 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (185 votes), past polls