Mail Archives: cygwin/2001/07/02/10:32:05
Russell,
Depending on the terminal you're using, which termcap / terminfo entry
you've specified and the terminal window's size, less will produce
different literal output sequences as it paginates and line-wraps its
input. (Although I would have thought that if the output was not a tty, it
would forgo such manipulations and act just like cat.)
You really shouldn't use a program explicitly designed for visual display
on a terminal to feed a pipe to grep or any other processor.
Just grep the target file.
Randall Schulz
Mountain View, CA USA
At 06:21 2001-07-02, russell christian sears wrote:
>I have found a problem using less and grep to search a file. The file is
>available at: http://www.cis.ohio-state.edu/~sears/file.txt (It is over 1
>megabyte, so I did not include it in this message.)
>
>I am using bash, and a complete, current installation of cygwin.
>
>When I run the command `less file.txt | grep cygwin` it sometimes fails to
>find a match in the file, even though the file does contain the string.
>
>It seems to be sporadic, but I have been able to reproduce the problem on
>three machines, each of which ran at about 700mhz. Other commands that
>seem to work as expected follow:
>
>less file.txt | cat | grep cygwin
>cat file.txt | grep cygwin
>grep cygwin file.txt
>
>If you have difficulty reproducing the bug, try running the command
>multiple times (eg: by repeating <up-arrow>, <enter> rapidly). Some
>installations will only rarely have a problem, others will rarely yield
>the correct result. On systems that usually produce the correct result,
>re-running the command rapidly seems to increase the likelihood of the
>problem ocurring.
>
>Also, the string "cygwin" always appears at the end of a line in the file,
>which may be related to this bug.
>
>I have tried both version 1.1.8 and the current cygwin distribution.
>(1.3.2) Both seem to suffer from this problem.
>
>As a control, I've checked this against a Linux system, and the bug did
>not exist there.
>
>Below, the mount mode is listed as textmode. The bug exists under binmode
>as well.
>
>...
--
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 -