Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 May 2005 13:29:46 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        cpghost <cpghost@cordula.ws>
Cc:        Fafa Hafiz Krantz <fteg@london.com>
Subject:   Re: On removing ^M
Message-ID:  <20050509102946.GA2740@orion.daedalusnetworks.priv>
In-Reply-To: <20050509102102.GA58668@fw.farid-hajji.net>
References:  <20050508192019.127ED1CE303@ws1-6.us4.outblaze.com> <20050508213407.GA2150@gothmog.gr> <20050509102102.GA58668@fw.farid-hajji.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-05-09 12:21, cpghost <cpghost@cordula.ws> wrote:
>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

Yes.  You're right, of course :-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050509102946.GA2740>