This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: grep: $ in PATTERN doesn't seem to work properly


>> On Sat, 21 Aug 2004, Hannu E K Nevalainen wrote:
>> 
>>> Note that there is a difference depending on how you create the
>>> file; I'll hand over to cygwin-specialists to explain (or ponder
>>> on) why it has to be this way. 
>>> 
>>> I'm running BINARY mounts all over, still I get the behaviour
>>> below.
<SNIP>

> On Sat, Aug 21, 2004 at 07:07:21PM -0400, Igor Pechtchanski wrote:
>> This has to do with the way "cat" behaves.  By default, Windows sends
>> textmode line endings from the console.  Most applications
>> (including od, echo, bash, etc) compensate for this somehow, except
>> "cat", which *always* replicates the output character by character,
>> doing no processing *whatsoever*.  AFAIK, this is by design.
>> 
>> Case in point:
>> 
>> $ od -c
>> <Enter><Ctrl-D>
>> 0000000  \n
>> 0000001
>> $ cat | od -c
>> <Enter><Ctrl-D>
>> 0000000  \r  \n
>> 0000002
>> $ perl -pe 1 | od -c
>> <Enter><Ctrl-D>
>> 0000000  \n
>> 0000001
>> $ # Note, however:
>> $ perl -pe 1 | cat | od -c
>> <Enter><Ctrl-D>
>> 0000000  \n
>> 0000001
>> $
>
> See also <http://www.cygwin.com/ml/cygwin/2003-04/msg02268.html>
> I once sent a patch to a transient coreutils maintainer but
> there was no followup.
> 
> Pierre

$ type -a cat
cat is /usr/bin/cat
cat is /bin/cat
$ cygcheck -f /bin/cat
textutils-2.0.21-1

I would appreciate if this DOS-text-ism could be removed.
Would applying the above patch have hard to handle side effects?
I guess some important scripts could be affected :-7 ...


/Hannu E K Nevalainen, B.Sc. EE Microcomputer systems            --72-->

** mailing list preference; please keep replies on list **

-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]