| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=3.4 required=5.0 tests=AWL,BAYES_50,DONT_USE_RAW_EMAIL_IN_BODY,T_RP_MATCHES_RCVD |
| X-Spam-Check-By: | sourceware.org |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: [ANNOUNCEMENT] Updated: grep-2.6.3-1 |
| References: | <announce DOT 20100720212708 DOT GA13740 AT ednor DOT casa DOT cgf DOT cx> |
| From: | ht AT inf DOT ed DOT ac DOT uk (Henry S. Thompson) |
| Date: | Fri, 27 Aug 2010 14:32:31 +0100 |
| Message-ID: | <f5bd3t4tc40.fsf@calexico.inf.ed.ac.uk> |
| User-Agent: | Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.21 (linux) |
| MIME-Version: | 1.0 |
| X-Edinburgh-Scanned: | at treacle.ucs.ed.ac.uk with MIMEDefang 2.60, Sophie, Sophos Anti-Virus, Clam AntiVirus |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
cgf wrote:
> Note that [now] grep opens files in binary mode for both reading and writing
> so the output of grep will always have \n endings unless you specify the
> --binary option which will (perhaps paradoxically) force the output to
> reflect exactly what was in the file being grepped.
For those of us who only RTFM [1] when forced to, I learned the hard way
that the mapping of \r\n to \n implied above actually happens on
_input_, so many patterns involving \r will fail w/o --binary.
You have been warned.
ht
[1] The online documentation reads:
By default, under ms-dos and ms-Windows, grep guesses the file type
by looking at the contents of the first 32kB read from the file. If
grep decides the file is a text file, it strips the CR characters
from the original file contents (to make regular expressions with ^
and $ work correctly). Specifying [--binary] overrules this
guesswork, causing all files to be read and passed to the matching
mechanism verbatim; if the file is a text file with CR/LF pairs at
the end of each line, this will cause some regular expressions to
fail. This option has no effect on platforms other than ms-dos and
ms-Windows.
--
Henry S. Thompson, School of Informatics, University of Edinburgh
10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 651-1426, e-mail: ht AT inf DOT ed DOT ac DOT uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail from me _always_ has a .sig like this -- mail without it is forged spam]
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |