Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Newlines: reading files that were created on other platforms

by blueberryCoffee (Scribe)
on Feb 02, 2005 at 01:23 UTC ( [id://427113]=note: print w/replies, xml ) Need Help??


in reply to Newlines: reading files that were created on other platforms

Since the \015 and \012 are not used for anything but newlines why not just look through the file _untill_ you see \015 or \012. If \015 is found and followed by \012 you know it is windows. If \015 without \012 you know its mac, and \012 by itself is linux.
  • Comment on Re: Newlines: reading files that were created on other platforms

Replies are listed 'Best First'.
Re^2: Newlines: reading files that were created on other platforms
by adamk (Chaplain) on Feb 02, 2005 at 06:50 UTC
    You can't do this, it isn't enough.

    In some situations, mostly ugly ones involving CVS, you can end up with mixed carriage returns in the file. Some Mac person edits 50 lines in the middle and the result is a mixed mess.

    So there are cases where doing anything by doing the two part, "detect the first and then process assuming it stays the same" just won't be good enough.

    You really do need to do some preprocessing to "localize" all of the newlines.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-19 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found