Date: Tue, 25 Dec 2001 22:07:21 -0500 From: parv <parv_@yahoo.com> To: f-q <freebsd-questions@freebsd.org> Subject: Re: Dos -> Unix end-of-line conversion Message-ID: <20011225220721.C55635@moo.holy.cow> In-Reply-To: <20011225214242.B55635@moo.holy.cow>; from parv_@yahoo.com on Tue, Dec 25, 2001 at 09:42:42PM -0500 References: <20011226113216.A24782@grimoire.chen.org.nz> <LPBBIGIAAKKEOEJOLEGOCEGDCKAA.barbish@a1poweruser.com> <20011225214242.B55635@moo.holy.cow>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <directory> \( -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011225220721.C55635>
