Mail Archives: cygwin/2002/05/31/00:42:14
On Fri, May 31, 2002 at 01:51:44PM +1000, Robert Mark Bram wrote:
>Howdy Christopher!
>
>Well, I get this when I do od:
>
>Robert Mark Bram AT DIJONG /home/Rob
>$ cat >file
>one.doc
>
>Robert Mark Bram AT DIJONG /home/Rob
>$ od -c file
>0000000 o n e . d o c \r \n
>0000011
>
>Robert Mark Bram AT DIJONG /home/Rob
>$ grep .doc$ file
>one.doc
>
>Robert Mark Bram AT DIJONG /home/Rob
>$
>
>
>
>So my question then is: why doesn't \r\n count as end of the line for $ in
>grep?
>
>And then.. is there a way I can fix it so it works the same in Cygwin as it
>would for Sun?
I spent the last hour trying to track down this "cygwin bug". It sure didn't
seem to be working the way that I expected.
What I found is that this is a cat "feature":
/* If stdin is a terminal device, and it is the ONLY
input file (i.e. we didn't write anything to the
output yet), switch the output back to TEXT mode.
This is so "cat > xyzzy" creates a DOS-style text
file, like people expect. */
if (tty_in && optind <= argc)
setmode (output_desc, O_TEXT);
This is from the cat sources. I'm a person but I wouldn't expect that
particular behavior.
A workaround may be to do:
cat /dev/tty > filter
That tricks cat into thinking it has an argument so it won't do
any help binmode/textmode conversions.
cgf
--
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 -