LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-26-2012, 12:11 PM   #1
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Rep: Reputation: 60
Adding Color using More


Daily Stupid Question:

When I use a cat with a grep I can see "blind SQL injection vulnerablity" highlighted as red and is easily readable

Code:
cat file |grep -i 'blind\ SQL\ injection\ vulnerability'
When I add a more to view the results page at a time, the color is taken away and is very hard to read.

Code:
cat file |grep -i 'blind\ SQL\ injection\ vulnerability'|more
How can I add the color when using more to view stuff page by page?
 
Old 07-26-2012, 02:12 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
I don't know if it can be done with more. It can be done using less instead of more.

Here's a link to a short article on how to do it. The .bashrc alias offered in the Comments section works best for me.

http://alicious.com/piping-ls-through-less-with-colors/
 
Old 07-26-2012, 03:36 PM   #3
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
Many thanks for the reply, Acutally you can specify the
Code:
--colors=always
using grep and it will force colors to always be "on". This was suggested to me by another forum which resolved the issue. So I added alias grep='grep --color=always' to my .bashrc, sourced it.

worked like a charm:

Code:
cat file |grep -i 'blind\ SQL\ injection\ vulnerability'|more

Last edited by metallica1973; 07-26-2012 at 03:38 PM.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Adding HP Color LaserJet CM2320nf MFP to CUPS mitchell7man Linux - Hardware 3 07-14-2010 09:02 PM
Adding color to a shell script? trace_effect Linux - Newbie 2 12-01-2009 05:00 AM
Color registration bars on output: Lexmark C510 Color Laser printer spud_linux Linux - Hardware 2 10-06-2008 12:46 PM
The command for adding color to a console Phaux Linux - Newbie 2 12-26-2005 03:20 PM
Adding Color To Source Code? ']['HeBroken Programming 9 10-24-2004 03:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration