perl -i.can -please file
is a general-purpose newline fixer. When you run it on Windows, it will turn Unix-style newlines into Windows-style newlines (and will leave Windows-style newlines alone). When you run it on Unix, it will turn Windows-style newlines into Unix-style newlines (and will leave Unix-style newlines alone).
Unfortunately, converting to and from Mac-style newlines isn't covered by this.
Don't forget to eventually throw the backups into the trash can:
rm *.can
del *.can
If you want to use wildcards with this command unders Windows, then put the following into a file called "atch.pm" under perl/site/lib:
@ARGV= map { glob } @ARGV;
then use a command like this:
perl -Match -i.can -please *.ext
This message was sponsored by The World League For Cute But Useful Idioms.
Update: {grumble} ChemBoy just made me realize that this only works when run under Win32. Oh well,
perl -i.can -pley/\\r//d
should work even for Win32 files on a Mac and on Mac files under Unix and Win32, except that you should not double the \ under Win32 and I don't know whether you should on a Mac. Note that this solution also removes "\r"s from the middle of lines. We need to remove them from front of lines for converting between Win32 and Mac formats and from the ends of lines for Win32-to-Unix conversion.
-
tye
(but my friends call me "Tye") |