On removing ^M
cpghost
cpghost at cordula.ws
Mon May 9 03:23:17 PDT 2005
On Mon, May 09, 2005 at 12:34:08AM +0300, Giorgos Keramidas wrote:
> 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
Wouldn't this also catch directories or special files with ^M in them?
I'd add a "-type f" to find to avoid errors while trying to write to
a directory:
$ find . -type f | while read fname ;do
if grep '^M' "${fname}" >/dev/null 2>&1 ;then
sed -i '' -e 's/^M//g' "${fname}"
fi
done
Regards,
-cpghost.
--
Cordula's Web. http://www.cordula.ws/
More information about the freebsd-questions
mailing list