I tried your test case with DJGPP 2.04 beta `grep' 2.63 and it seems to work
as expected. I would assume that an update to version 2.63 from the current
2.54 version might help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe; maybe not. It works fine for me, with my MSYS version of grep:
$ grep --version
GNU grep 2.5.4
$ cat <<eof> a.txt</eof>
this
is
a
test
EOF
$ grep -n --color=always test a.txt
4:test <"test" appears here in red>
What is apparent in the OP's post is that grep is emitting ANSI terminal
control sequences to control colour. A standard Windows console doesn't know
how to interpret those, so we see the raw control codes in the output. MSYS
provides its own terminfo emulation layer, to translate those ANSI codes into
the appropriate Windows console API function calls; perhaps your DJGPP variant
does something similar?
BTW, it is the existence of the terminfo emulation layer which allows the MSYS
implementation of GNU "info" to run successfully, when -- last time I looked
-- the GnuWin32 implementation just says "terminal is too dumb to run info".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am no expert on DJGPP version 2 internals but it works just like the old DOS
programs in command line mode. It may use the MS terminal control layers or it
may use its own similar versions. It does not use Windows 32-bit API at all.
It may also run on old DEC systems such as VAX/VMS with VT100/102 terminals.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using grep with --color doesn't work. For example, the following command
doesn't show the search in red (which is the default):
grep -r -n --color=always "test" a.txt
Instead you'll get:
←[32m←[K4←[m←[K←[36m←[K:←[m←[K←[01;31m←[Ktest←[m←
I tried your test case with DJGPP 2.04 beta `grep' 2.63 and it seems to work
as expected. I would assume that an update to version 2.63 from the current
2.54 version might help.
Maybe; maybe not. It works fine for me, with my MSYS version of grep:
$ grep --version
GNU grep 2.5.4
$ cat <<eof> a.txt</eof>
this
is
a
test
EOF
$ grep -n --color=always test a.txt
4:test <"test" appears here in red>
What is apparent in the OP's post is that grep is emitting ANSI terminal
control sequences to control colour. A standard Windows console doesn't know
how to interpret those, so we see the raw control codes in the output. MSYS
provides its own terminfo emulation layer, to translate those ANSI codes into
the appropriate Windows console API function calls; perhaps your DJGPP variant
does something similar?
BTW, it is the existence of the terminfo emulation layer which allows the MSYS
implementation of GNU "info" to run successfully, when -- last time I looked
-- the GnuWin32 implementation just says "terminal is too dumb to run info".
I am no expert on DJGPP version 2 internals but it works just like the old DOS
programs in command line mode. It may use the MS terminal control layers or it
may use its own similar versions. It does not use Windows 32-bit API at all.
It may also run on old DEC systems such as VAX/VMS with VT100/102 terminals.