topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 3:17 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Gnu grep how can I get colored output in ms concole?  (Read 7626 times)

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Gnu grep how can I get colored output in ms concole?
« on: May 15, 2009, 08:13 PM »
I cannot seem to get colored output from Gnu Grep. I tried the color option maybe standard ms console does not support such thing. Does anyone know a solution?

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Gnu grep how can I get colored output in ms concole?
« Reply #1 on: May 16, 2009, 06:20 PM »
Seems ansi.sys isn't installed on Vista.  You may have to run bash shell and use --color option on the grep command. I know I had ls output with color so there must be a way to do it.  It's been a few years though. There should be a way to set up an alias in bash so that the --color param is appended automatically.  Something like:  grep=grep --color  and ls=ls --color   plus whatever other default params you want to stick on.

See bash win32 docs for alias commands



« Last Edit: May 16, 2009, 06:43 PM by MilesAhead »

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: Gnu grep how can I get colored output in ms concole?
« Reply #2 on: May 17, 2009, 04:26 PM »
You could try third-party Windows-ised ANSI programs, like the ones by Jason Hood, or ANSIPlus by Kris Sweger.

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Re: Gnu grep how can I get colored output in ms concole?
« Reply #3 on: May 17, 2009, 09:44 PM »
Thanks people, I will check out these stuff.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Gnu grep how can I get colored output in ms concole?
« Reply #4 on: May 18, 2009, 01:03 AM »
Being a DOS application/device driver, ANSIPLUS doesn't sound like something that'll work (properly) with NT-based operating systems?
- carpe noctem

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: Gnu grep how can I get colored output in ms concole?
« Reply #5 on: May 18, 2009, 07:59 AM »
Being a DOS application/device driver, ANSIPLUS doesn't sound like something that'll work (properly) with NT-based operating systems?

ANSIPLUS and Windows
Users of Windows 98, 95, 3.1 or NT 4 should consider using ANSIPLUS as well. The ANSIPLUS driver works well under Windows, and because ANSIPLUS is a CON device driver, local copies of it are included in each Windows virtual DOS machine. This means that all the ANSIPLUS internal state variables, and those of its integrated console features, will be local to each virtual machine, so there is no way they can interfere with each other. This section discusses how to work around the specific limitations imposed on ANSIPLUS DOS sessions by Windows or by Windows in combination with other software.

The following topics are covered here: Loading options, Full screen vs. windowed DOS sessions, Copy and paste, Scroll-back, Color palettes, Beep tone, International usage, and Windows NT.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Gnu grep how can I get colored output in ms concole?
« Reply #6 on: May 18, 2009, 08:29 PM »
Being a DOS application/device driver, ANSIPLUS doesn't sound like something that'll work (properly) with NT-based operating systems?
Being a DOS application/device driver, ANSIPLUS doesn't sound like something that'll work (properly) with NT-based operating systems?

'sides, I'm fairly certain if you use Win32 Gnu bash stuff all that Linux color output will work.  It's not that big a deal to set it up. It's just it's been a couple of years so I'm not sure which LinuxOnWindows type site is the one to go with.  My memory lags. :)

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Gnu grep how can I get colored output in ms concole?
« Reply #7 on: May 19, 2009, 08:23 AM »
rjbull: I only have 64bit installs of Windows atm, so I can't test it - but my guess is that for NT it's only going to affect the current (ie, not all cmd.exe instances), and either won't work for win32 console applications or is going to slow down console output tremendously - will probably work for 16bit dos applications, but possibly also involving slowdown.

Anyway, the best option would be getting tools that natively support the win32 console API (or a shell that supports ANSI colors...), instead of resorting to hacks. Too bad the UnxUtils project is dead, so you're probably stuck with the cygwin (bleargh!) based gnuwin32 :(
- carpe noctem

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Gnu grep how can I get colored output in ms concole?
« Reply #8 on: May 19, 2009, 09:52 AM »
I cannot seem to get colored output from Gnu Grep. I tried the color option maybe standard ms console does not support such thing. Does anyone know a solution?


Depending what you are doing, you may find this useful:

http://betterthangrep.com/