delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/21/20:12:47

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3C759B04.72F4DBF5@insight.rr.com>
Date: Thu, 21 Feb 2002 20:12:36 -0500
From: Paul McFerrin <MailHole AT insight DOT rr DOT com>
Reply-To: pmcferrin AT insight DOT rr DOT com
X-Mailer: Mozilla 4.78 [en] (Win98; U)
X-Accept-Language: en,pdf
MIME-Version: 1.0
To: Benjamin Altman <Benjamin DOT Altman AT noaa DOT gov>
CC: cygwin AT cygwin DOT com
Subject: Re: cygwin gnu grep thinks text files are binary
References: <029501c1bac8$fba059a0$af0c5a8c AT nws DOT noaa DOT gov>

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::
=============================================================================
#!/bin/sh

if [ -f .._+_.. ]
then
	rm -f .._+_..
	if [ $? -ne 0 ]
	then
		echo "Failed to remove file \".._+_..\"" 1>&2
		exit 2
	fi
fi

trap '' 1 2 3 15
for f in $*
do
	echo "Processing file: $f" 1>&2
	mv $f .._+_..
	if [ $? -ne 0 ]
	then
		echo "Failed to move file $f to \".._+_..\"" 1>&2
		exit 2
	fi
	tr -d '\r' <.._+_.. >$f
	touch -r .._+_.. $f
done
=============================================================

To use it:
	$ rmcr files ...

-paul mcferrin




Benjamin Altman wrote:
> 
> Hello,
> 
> 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.
> 
> Thanks,
> Ben
> 
> --
> 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 AT insight DOT rr DOT com but in
          reality it came from pmcferrin AT insight DOT rr DOT com.  If you send
          a reply to this message, it *should* get delivered to the
          correct place.

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019