On Tue, Nov 07, 2006 at 11:43:49AM -0500, Greg London wrote: > If I run unix2dos twice on a file, > it will fix the bad lines, but the lines > that were OK end up with empty > lines in between every line.
In fact, you may have extra carriage returns from the lines that were correct originally. > Anyway, I think I need a unix2dos > script that will just fix the unix newlines > without modifying the dos newlines. > > but I'm not exactly sure. > Some instruction and some code > would probably be helpful. A Unix newline is just a line feed, "\x0A", while a Windows newline is a carriage return followed by a line feed, "\x0D\x0A". So to convert a mixed file to a Windows file, you only want to replace "\x0A" when it's not preceded by "\x0D". perl -pi -e 's/(?<!\x0D)\x0A/\x0D\x0A/g' Ronald _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

