Incidentally, I normally get rid of trailing carriage returns this way:

sed 's/\015$//' file.txt > newfile.txt

This deletes CR (octal 15) if and only if it's the last character on a line. To filter either type of file, you can use:

sed -e 's/\015$//' -e 's/\015/\012/g' file.txt > newfile.txt

The first expression (after the '-e') replaces CRLF with LF, the second replaces CR alone with LF. That way the file will end up a normal UNIX text file no matter which kind it is.

Create a script that you can run from the shell with these commands.

sudo cat > /usr/local/bin/unixfy << \!
#!/bin/sh

sed -e 's/\015$//' -e 's/\015/\012/g' ${1+"$@"}
!
sudo chmod 755 /usr/local/bin/unixfy

Then from the command line you can do:

unixfy file.txt > newfile.txt

From textedit, you can use Devon Technologies' "Word Service" to convert text between UNIX, Mac, and DOS line endings.

http://www.devon-technologies.com/products/freeware/services.php


--
Unsupported OS X is sponsored by <http://lowendmac.com/>

     Support Low End Mac <http://lowendmac.com/lists/support.html>

Unsupported OS X list info <http://lowendmac.com/lists/unsupported.html>
 --> AOL users, remove "mailto:";
Send list messages to:     <mailto:[email protected]>
To unsubscribe, email:     <mailto:[EMAIL PROTECTED]>
For digest mode, email:    <mailto:[EMAIL PROTECTED]>
Subscription questions:    <mailto:[EMAIL PROTECTED]>
Archive <http://www.mail-archive.com/unsupportedosx%40mail.maclaunch.com/>

iPod Accessories for Less
at 1-800-iPOD.COM
Fast Delivery, Low Price, Good Deal
www.1800ipod.com

Reply via email to