A new addition to my .bashrc, a bash function that will swap Macintosh newlines for UNIX ones:
function mac2unix()
{
sed 's/\r/\n/gi'
}
To use it, pipe it as so:
cat file.txt.bad-newlines | mac2unix > file.txtThis will convert Macintosh newlines from files that Mac friends forgot to upload in ASCII mode. If this is not done, programs will ignore the Macintosh newlines and files will have no newlines, which goes without saying is very annoying.
These other articles I've written may be interesting to you as well:
Recent comments
3 weeks 2 days ago
8 weeks 11 hours ago
8 weeks 13 hours ago
9 weeks 4 days ago
9 weeks 6 days ago
11 weeks 5 days ago
11 weeks 6 days ago
12 weeks 9 hours ago
12 weeks 1 day ago
12 weeks 2 days ago