There are a lot of different ways to encode file newlines. DOS uses "\r\n", Unix uses just "\n" and some Mac files use just "\r".
I normally want them Unix style, and created a simple script to solve this problem. It is really simple, but really useful. It works both for DOS and Mac files very well.
Update: Sorry but the missing parenthesis are important.
#!/usr/bin/perl -pi s/(\012?\r|\r?\012)/\012/g;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: No Control M
by cazz (Pilgrim) on Apr 08, 2005 at 19:45 UTC | |
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 | |
|
Back to
Cool Uses for Perl