From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.62) (envelope-from ) id 1HZXSW-0006wX-Pr for garchives@archives.gentoo.org; Thu, 05 Apr 2007 19:17:25 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l35JDEha019477; Thu, 5 Apr 2007 19:13:14 GMT Received: from mxfep04.bredband.com (mxfep04.bredband.com [195.54.107.79]) by robin.gentoo.org (8.14.0/8.14.0) with ESMTP id l35J5Fq5008707 for ; Thu, 5 Apr 2007 19:05:15 GMT Received: from ironport2.bredband.com ([195.54.107.84] [195.54.107.84]) by mxfep04.bredband.com with ESMTP id <20070405190515.TOFC2732.mxfep04.bredband.com@ironport2.bredband.com> for ; Thu, 5 Apr 2007 21:05:15 +0200 Received: from c-23e272d5.08-92-73746f37.cust.bredbandsbolaget.se (HELO [192.168.2.117]) ([213.114.226.35]) by ironport2.bredband.com with ESMTP; 05 Apr 2007 21:05:12 +0200 Message-ID: <461548D6.4050103@bredband.net> Date: Thu, 05 Apr 2007 21:07:02 +0200 From: Tony Stohne User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Why are gentoo people so in love with colorized output?!? References: <20070404041739.GA15293@crowfix.com> <87fy7glkzg.fsf@newton.gmurray.org.uk> <200704040822.13232.bo.andresen@zlin.dk> <200704051807.36759.michaelkintzios@gmail.com> In-Reply-To: <200704051807.36759.michaelkintzios@gmail.com> X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Archives-Salt: 831229ae-6241-428c-9179-80d01adb8146 X-Archives-Hash: 5c5c52f2f827d3341f7823f9e58602f6 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mick said the following on 2007-04-05 19:07: | ... | Hmm, neither less not cat give me color output. Passing --color=y to either | tells me things like: | ============================== | There is no color=y option ("less --help" for help) | ============================== | | I also tried --color but it's all still shown in black & white. How do you | pipe a file and get it to show in color? Am I missing something in | my .bashrc or elsewhere? To make less interpret color escape sequences, you need the -R option. export LESS=-R in your shell startup script and you-ll have it as default. Generally, you don't want to use less -r, which allows arbitrary control characters through to affect the terminal (which tend to create major garbage). Color is added via ANSI escape sequences, which don't work in all displays/terminals/consoles, but as an example: grep is smart enough to detect this and won't use color (even when specified) if you're sending the output via a pipeline. Otherwise, if you piped the output, eg to less, the ANSI escape sequences would send garbage to the screen. ~ If, on the other hand, that's really what you want to do (without the garbage), there's a workaround: use the --color=always to force it through and call less with the -R flag (which prints ALL RAW control characters). That way, the color codes will escape correctly and you'll page through screens of text with your matched patterns in full color: grep --color=always "regexp" the_file_you_want_to_wade_through | less -R That should do the trick :) //Regards Tony PS. Have a nice Easter everyone! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) iD8DBQFGFUjWJDzv6DN+QUkRArevAKDoe0VND3TXj0o0kV3KkrD7cwPmBgCfUF27 VgMOQFi+i5rwL2p0rpljZ70= =w/na -----END PGP SIGNATURE----- -- gentoo-user@gentoo.org mailing list