[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep 2.5 on recent cygwin - end-of-line problem
From: |
olivier Dulac |
Subject: |
grep 2.5 on recent cygwin - end-of-line problem |
Date: |
Tue, 26 Oct 2004 19:55:53 +0200 |
Hello,
first of all, thanks for all the good work!
I *love* GNU utils. (yes, that's true love, but a platonic one)
Now here is where I get hit by some (maybe "normal"
but weird nonetheless) GNU grep 2.5 ("Cygwin edition")
subtelties: the "$" should "match the end of line" and
for me it doesn't, and it triggers some weird bug (causing
grep to end before finishing, and with a bad context causing
weird prompts after that)
This actually may be due to the Cygwin environment...
(bash , recent downloads of the 'stable' Cygwin environement
(recent being beginning of october 2004, not today))
(using GNU grep 2.5, and bash 2.05b.0(1)-release)
As this bug (whichever part being the faulty one) appears
while using grep, here it is:
I want to use grep as a caracter higlighter... (shame on me, I know,
but I can't use the vim or less highlighting for some devious reasons)
I want it to show ALL lines of a given file, with the regexp highlighted
(using '--color').
my_prompt$ egrep --color '$|the_regexp_I_want' toto
(so that I can get the colored matching expressions
within the WHOLE 'toto' file, not just the some lines of
context such as with -C or -A or -B)
So I tried to do the following:
( First of all I create the toto file: )
my_prompt$ cat > toto
1 A B C D
2 AA BB CC DD
3 AAA BBB CCC DDD
^D
my_prompt$
(this created the test file "toto".)
(Try 1 : OK )
my_prompt$ egrep --color '.|the_regexp' toto
1 A B C D
2 AA BB CC DD
3 AAA BBB CCC DDD
my_prompt$
(this outputs the whole non-empty lines of the
'toto' file, all colored, as it matched the "." everywhere)
(TRY 1 is synonymous to " grep --color . the_file " ... not what I want.
(Try 2 : WEIRD OUTPUT!? )
my_prompt$ egrep --color '$|the_regexp' toto
1 A B C D
(this highlights the "A", but leaves a blinking cursor waiting just after
the "D" ...)
(I have to do a CTRL+C to get back the prompt on the next line, and I
never get the whole 3 lines with colorised "A")
(Try 3 : WEIRDER OUTPUT!??? ) (JUST AFTER the preceding try)
my_prompt$ egrep --color '$|the_regexp' toto
1 A B C D
(this again highlights the "A", leaves a blinking cursor waiting just after
the "D" ... but this time after I CTRL+C the next prompt is in another
color (seems like a highlighted version of its original color, perhaps a
^[1m ? ), which it didn't do after TRY 2 ... (what was dark green and
brown in my prompt becomes light green and yellow))
So here are my questions:
Q1) how can I highlight a regexp and display the whole file with this
regexp
highlited within it ? (that's why I tried to match both the regexp I
want
AND the "$" which should have matched an empty end of line on each lines,
and shouldn't appear colorized (well, even if it is it is an empty end of
line so not much color should appear there!))
Q2) is my Email at the right place? if not where should I post this? (it
does
come from grep, even though it may be due to obscur use of other parts of
Cygwin libraries... I don't know if I can use "strace" or similar under
Cygwin)
Q3) I did the tries within the Cygwin prompt (not in a CMD prompt, nor in
a
X-window xterm)... And I read the other 2 may have different
properties...
Is there a "best place" where I should use grep in ?
Q4) what tools can I use, in Cygwin, to try to pin down where the actual
problem is ? is "gdb" or "strace" usefull in this environement?
(probably a
Cygwin question, though... But if you do know, please tell me, even if
you
flame me first :) )
Thanks for your suggestions, and please continue the good work!
And I'll try to contribute some day (when I really learn how to program,
and get some free time, and, oh yes, find something I am actually able to
help with!)
Olivier Dulac, still in Larval stage ...
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.com/
- grep 2.5 on recent cygwin - end-of-line problem,
olivier Dulac <=