Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: unix->dos & dos->unix

by giulienk (Curate)
on Oct 10, 2002 at 09:08 UTC ( #204119=note: print w/replies, xml ) Need Help??


in reply to unix->dos & dos->unix

To have true portability you should use hex codes:
#DOS to UNIX perl -i.orig -pe 's/\015\012/\012/g' dosfile.txt
Take a look at perlrun for the -i switch. And remember the following hash with newline for Windows, UNIX and Mac. I usually declare this on top of my program when i need to do lots of translation or outputting different kind of files
%N = ( WIN => "\015\012", UNIX => "\012", MAC => "\015" );


$|=$_="1g2i1u1l2i4e2n0k",map{print"\7",chop;select$,,$,,$,,$_/7}m{..}g

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://204119]
help
Chatterbox?
[zentara]: it's useful if you want to lockup a multicore machine :-)
[zentara]: marto I would give up the key easy with drugs....
[Corion]: Discipulus: No, the Perl opcodes are more high-level than the raw processor opcodes
[zentara]: sodium pentathol and a beautiful woman interogator :-)
[Discipulus]: thanks Corion if so i probably never meet them in my life.. ;=)
[Discipulus]: have you all a nice and relaxing weekend!
NodeReaper on the other hand, I've already bought the hammer....

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2017-07-28 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (428 votes). Check out past polls.