On 2005-05-08 14:20, Fafa Hafiz Krantz <[EMAIL PROTECTED]> wrote: > > Good day all! > > I am aware of the port unix2dos (dos2unix) as a tool to > remove ^Ms from ASCII files. > > But if you execute dos2unix in a directory where some files > contain ^M (CR/LF) and some files don't (CR), then dos2unix > will make a mess of those files who don't. > > I am wondering what is needed (what tool or what code) to > do a mass (recursive) removal of ^Ms?
No "tool" is needed, as long as you have FreebSD's shell, sed & grep: $ find . | while read fname ;do if grep '^M' "${fname}" >/dev/null 2>&1 ;then sed -i '' -e 's/^M//g' "${fname}" fi done _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"