Date: Mon, 9 May 2005 12:21:02 +0200 From: cpghost <cpghost@cordula.ws> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: Fafa Hafiz Krantz <fteg@london.com> Subject: Re: On removing ^M Message-ID: <20050509102102.GA58668@fw.farid-hajji.net> In-Reply-To: <20050508213407.GA2150@gothmog.gr> References: <20050508192019.127ED1CE303@ws1-6.us4.outblaze.com> <20050508213407.GA2150@gothmog.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050509102102.GA58668>