----- Original Message ----- From: "Giorgos Keramidas" <[EMAIL PROTECTED]> To: cpghost <[EMAIL PROTECTED]> Subject: Re: On removing ^M Date: Mon, 9 May 2005 13:29:46 +0300
> > On 2005-05-09 12:21, cpghost <[EMAIL PROTECTED]> 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 :-) Very good! Thank you all! So in conclusion, does this sh script look good? I mean, can the first 3 commands be put like that? $ chown -R fafa:wheel * $ find . -type d -exec chmod 755 {} \; $ find . -type f -exec chmod 644 {} \; $ find . -type f | while read file ; do if grep '^M' "${file}" >/dev/null 2>&1 ; then sed -i '' -e 's/^M//g' "${file}" fi done Forever grateful! That's me. -- Fafa Hafiz Krantz Research Designer @ http://www.home.no/barbershop Enlightened @ http://www.home.no/barbershop/smart/sharon.pdf -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"