From owner-freebsd-questions@FreeBSD.ORG Mon May 9 19:13:23 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5DC5416A4EA for ; Mon, 9 May 2005 19:13:23 +0000 (GMT) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF6AD43D41 for ; Mon, 9 May 2005 19:13:21 +0000 (GMT) (envelope-from fteg@london.com) Received: from unknown (unknown [192.168.9.180])AA7811800222 for ; Mon, 9 May 2005 19:13:21 +0000 (GMT) X-OB-Received: from unknown (205.158.62.49) by wfilter.us4.outblaze.com; 9 May 2005 19:13:21 -0000 Received: by ws1-1.us4.outblaze.com (Postfix, from userid 1001) id 924034BEAE; Mon, 9 May 2005 19:13:21 +0000 (GMT) Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 X-Mailer: MIME::Lite 2.117 (F2.6; A1.17; B2.12; Q2.03) Received: from [213.187.181.70] by ws1-1.us4.outblaze.com with http for fteg@london.com; Mon, 09 May 2005 14:13:21 -0500 X-Mailer: mail.com webmail From: "Fafa Hafiz Krantz" To: "Giorgos Keramidas" , cpghost Date: Mon, 09 May 2005 14:13:21 -0500 X-Originating-Ip: 213.187.181.70 X-Originating-Server: ws1-1.us4.outblaze.com Message-Id: <20050509191321.924034BEAE@ws1-1.us4.outblaze.com> cc: freebsd-questions@freebsd.org Subject: Re: On removing ^M X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2005 19:13:23 -0000 ----- Original Message ----- From: "Giorgos Keramidas" To: cpghost Subject: Re: On removing ^M Date: Mon, 9 May 2005 13:29:46 +0300 >=20 > On 2005-05-09 12:21, cpghost 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 >=20 > 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 --=20 ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm