This is the mail archive of the
mailing list for the Cygwin project.
Re: cygwin gnu grep thinks text files are binary
- From: Paul McFerrin <MailHole at insight dot rr dot com>
- To: Benjamin Altman <Benjamin dot Altman at noaa dot gov>
- Cc: cygwin at cygwin dot com
- Date: Thu, 21 Feb 2002 20:12:36 -0500
- Subject: Re: cygwin gnu grep thinks text files are binary
- References: <firstname.lastname@example.org>
- Reply-to: pmcferrin at insight dot rr dot com
There was a posting within this past month about grep considering files
to be binary if the newlines were followed by \r. I'm assumming that
someone made note of that bug.
Just FYI, here is a filter I've written that removes \r from files. It
also preserves mtime::
if [ -f .._+_.. ]
rm -f .._+_..
if [ $? -ne 0 ]
echo "Failed to remove file \".._+_..\"" 1>&2
trap '' 1 2 3 15
for f in $*
echo "Processing file: $f" 1>&2
mv $f .._+_..
if [ $? -ne 0 ]
echo "Failed to move file $f to \".._+_..\"" 1>&2
tr -d '\r' <.._+_.. >$f
touch -r .._+_.. $f
To use it:
$ rmcr files ...
Benjamin Altman wrote:
> I was trying to do a grep against some html files I got through wget in
> Cygwin with the repeated message "Binary file xxx.html matches". Since grep
> thinks they are binary files I don't get to see any of the lines contained.
> Would anyone know why this is happening and how to get around this? The
> html files have ^M at the end of each line but I don't think that should
> cause this. Looking in the FAQ didn't help and I tried google searches
> without success.
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
NOTE*** This email looks it came from MailHole@insight.rr.com but in
reality it came from email@example.com. If you send
a reply to this message, it *should* get delivered to the
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html