GNU bug report logs -
#16979
Strange behavior with "grep --color=auto" with dot in expression
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Strange behavior with "grep --color=auto" with dot in expression
For some reason, ssh produces output with CRLF when there is a key
problem, and when I redirected that to a file, and used grep to search
through it, I found that it seemed like "." was not matching correctly,
but when you pipe the output to "cat", it looks as expected. And without
"--color=auto" or with unix line endings, it works fine.
$ alias grep
alias grep='grep --color=auto'
$ diff <(hexdump -C file.txt) <(hexdump -C file2.txt)
4,5c4,5
< 00000030 41 53 54 59 21 0d 0a |ASTY!..|
< 00000037
---
> 00000030 41 53 54 59 21 0a |ASTY!.|
> 00000036
$ grep -i nasty file2.txt | grep .
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
$ grep -i nasty file.txt | grep .
$ grep -i nasty file.txt | grep . | cat
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
$ file file*
file2.txt: ASCII text
file.txt: ASCII text, with CRLF line terminators
I tested it in konsole and xterm, and both do the same, so I guess you
just need:
$ grep --version
grep (GNU grep) 2.14
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and others, see
<http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
$ bash --version
GNU bash, version 4.2.45(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
--
--------------------------------------------
Peter Maloney
Brockmann Consult
Max-Planck-Str. 2
21502 Geesthacht
Germany
Tel: +49 4152 889 300
Fax: +49 4152 889 333
E-mail: peter.maloney <at> brockmann-consult.de
Internet: http://www.brockmann-consult.de
--------------------------------------------
This bug report was last modified 11 years and 135 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.