LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   results in color (https://www.linuxquestions.org/questions/linux-newbie-8/results-in-color-802142/)

dina3e 04-15-2010 06:01 AM

results in color
 
Hi,
i want to search some pattern from a file and want to highlight the exact pattern with some color. is it possible?? i am able to highlight whole line.How could we go for exact that pattern only.

PMP 04-15-2010 06:04 AM

have you checked

Code:

grep --color
If you are not using grep, what are you using to search the pattern?

dina3e 04-15-2010 07:24 AM

i want to know for all the case of patterns , i mean by using awk,sed and grep , if i go for find of file how could i make all those output to some specific color.

PMP 04-15-2010 07:43 AM

Please elaborate your problem

dina3e 04-15-2010 08:25 AM

hi,
Code:

$cat my_file
11:30 20090407
/home/xyz/file3.txt
10:40 20090407
/home/xyz/file4.txt
09:30 20090407
$sed  -n '/11/p' my_file
11:30 20090407


PMP 04-15-2010 08:30 AM

Code:

grep --color '11' file

dina3e 04-15-2010 09:01 AM

Thanks for valuable answer.
But what about , if i go for awk and sed pattern matching.

PMP 04-15-2010 09:07 AM

Even I have to look for it. Probably someone will help.

grail 04-15-2010 09:43 AM

How about man sed or man awk and search for the word color??

Other ideas would be to put the words awk or sed and "print in color" in google, I wonder what that might show?


All times are GMT -5. The time now is 11:14 PM.