There are many places where PERL is incredibly handy. This is one of them. You can usePERL on the command line to change the line ending ( a '\r' (Mac) to a '\n' (UNIX) ):perl -pi -e 's/\r/\n/g' <filename>I have put an alias in my .bashrc file that looks like this:alias fle="perl -pi -e 's/\r/\n/g' "Now I just type fle <filename> and everything works file. I use "fle" for "fix line endings," butyo can use anything you want to.





[ Reply to This


vajonez on Wed, Oct 22 '03 at 02:19AMI've always used the following (in a file named fixascii):#!/bin/shzip -qr foo.zip "$@" && unzip -aqo foo.zip && rm foo.zipAnd then execute it as:fixascii [files or directories to convert]Which has the benefit over most of these other commands in that you can point it with impunity at an entire directory tree and it will process all the files in it and not corrupt any binaries that may happen to have a string of bits in them that look like a line-ending.I've seen too many times where someone corrupted a ton of images and other binaries, when trying to fix line-endings on text files using dos2unix or tr in combination with find but failed to ensure that only text files were processed. Unzip figure out which files are ascii, converts them, and leaves the binaries alone.BTW, it's the "-a" flag to unzip, that is causing the ascii files to have their lines endings converted.[ Reply to This