The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ls color on AIX tagger AIX 3 01-15-2009 04:11 AM
color highlighting with 'more','grep' and 'vi' new2ss UNIX for Dummies Questions & Answers 0 01-15-2008 05:19 AM
Vim color mirusnet Shell Programming and Scripting 1 01-06-2008 12:43 PM
tput smso (bold) ruins formatting pondlife Shell Programming and Scripting 2 02-07-2006 01:58 PM
ls color andryk AIX 3 05-14-2004 03:26 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-07-2009
blasto333 blasto333 is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 4
Grep ruins color

When I run:

git branch -a

I git a nice green and red colored output, but if I pipe the above command through grep:

git branch -a | grep -v "master"

I lose my colored output. Is there a way around this?
  #2 (permalink)  
Old 03-08-2009
JerryHone JerryHone is offline
Registered User
  
 

Join Date: Nov 2006
Location: UK
Posts: 178
I guess that the "git" command is streaming a stack of terminal control characters to change colours on the screen as well as the real data output. By piping the output through grep, you'll potentially be stripping those characters out of the stream going to the terminal. Can't see an easy solution!
  #3 (permalink)  
Old 03-09-2009
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,937
neither pipe nor grep will explicitly strip them out, but its not difficult for a program to tell whether its output is a terminal or not and adjust accordingly.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:20 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0