in reply to No Control M
- I prefer using dos2unix & mac2unix, as they are quite a bit faster than firing up perl, but I can see the usefulness of doing it all at once. (Though, a simple shellscript wrapper that calls dos2unix & mac2unix would probably still be faster)
- Also, you use octal as well as the escape sequences. Why not pick one method of representing characters and stick with it? \n is easier to read for most of us than \012.
- Your code can be faster by only mucking with files that have \r. If a file already has unix line endings, you are still modifying the data in place. Try this instead:
s/\r\n?/\n/g;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: No Control M
by ambs (Pilgrim) on Apr 08, 2005 at 19:56 UTC | |
by cazz (Pilgrim) on Apr 08, 2005 at 20:19 UTC | |
by ww (Archbishop) on Apr 08, 2005 at 21:08 UTC | |
by ambs (Pilgrim) on Apr 08, 2005 at 21:03 UTC | |
by cazz (Pilgrim) on Apr 08, 2005 at 21:10 UTC | |
by ambs (Pilgrim) on Apr 08, 2005 at 21:13 UTC |
In Section
Cool Uses for Perl