From owner-freebsd-questions Tue Dec 25 19: 5:29 2001 Delivered-To: freebsd-questions@freebsd.org Received: from swan.prod.itd.earthlink.net (swan.mail.pas.earthlink.net [207.217.120.123]) by hub.freebsd.org (Postfix) with ESMTP id D504537B41B for ; Tue, 25 Dec 2001 19:05:26 -0800 (PST) Received: from sdn-ar-007dcwashp023.dialsprint.net ([63.178.91.31] helo=moo.holy.cow) by swan.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16J4Ni-00016x-00 for freebsd-questions@freebsd.org; Tue, 25 Dec 2001 19:05:26 -0800 Received: by moo.holy.cow (Postfix, from userid 1001) id C11A550E29; Tue, 25 Dec 2001 22:07:21 -0500 (EST) Date: Tue, 25 Dec 2001 22:07:21 -0500 From: parv To: f-q Subject: Re: Dos -> Unix end-of-line conversion Message-ID: <20011225220721.C55635@moo.holy.cow> Mail-Followup-To: f-q References: <20011226113216.A24782@grimoire.chen.org.nz> <20011225214242.B55635@moo.holy.cow> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20011225214242.B55635@moo.holy.cow>; from parv_@yahoo.com on Tue, Dec 25, 2001 at 09:42:42PM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG alternatively, combine symlink checking in 'find', liberating 2 checks from the while loop/if condition. this could have been further modified to remove the "file readable" test, but i preferred to be notified about non-text/unreadable files. find \( -type f -a ! -type l \) | while read Old do # this needs to be more sophisticated; but something is better than # nothing # if ( ! file "$Old" | grep 'text' >/dev/null 2>&1 ) \ || [ ! -r "$Old" ] then echo '* ' $Old 'may not be a text file or not readable; skipping...' continue fi echo ' -- sanitizing ' $Old tr -d '\r' < "$Old" > "${Old}.changed" # optionally remove old files, keep only changed ones # #mv -f "${Old}.changed" "$Old" done -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message