Adding Color using More


 
Thread Tools Search this Thread
# 1  
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?
# 2  
Useless Use of Cat Award

Searching the manual page of grep for color, I find the --color option. Usually it only prints color when printing directly to a terminal -- color output would look ugly when dumped into a file -- but can be forced on with --color=always I believe.
This User Gave Thanks to Corona688 For This Post:
# 3  
Many thanks

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

# 4  
Please read:

Useless Use of Cat Award

Code:
grep string filename

is better than
Code:
cat filename | grep string

This User Gave Thanks to Corona688 For This Post:
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Science: Computers
Difficulty: Medium
FLAC stands for "Free Lossless Audio Condenser"'
True or False?

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Gawk adding color

I want to know if there is any way to highlight search results using GAWK. So for example: gawk '{IGNORECASE=1;} /^<a/&&/\$/' index.html <a class=author href="http://washingtondc.craigslist.org/search/?areaID=10&amp;amp;catAbb=sss&amp;amp;query=ps vita" title="craigslist washington, DC | all for sale... (3 Replies)
Discussion started by: metallica1973
3 Replies

2. UNIX for Dummies Questions & Answers

How to change the background color in the init 3 mode(not line color)

Hello, I am using RHEL 6.1 on VMware I am searching for a way to change background color (not line by line color wich one can using tput command) basically changing the color of the whole screen to white instead of the default black and changing font color to black and alos would like to... (2 Replies)
Discussion started by: Dexobox
2 Replies

3. OS X (Apple)

Adding Color to bash

Hey everyone, I have come across an issue to where I am trying to create a script which changes the text color with a simple if then statement. I have seen it done with Fedora 8 but when I try and create it using my MacBook Pro running Snow Leopard it doesn't work. Funny thing is, when I use... (2 Replies)
Discussion started by: dachadster13
2 Replies

Featured Tech Videos