LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-15-2010, 07:01 AM   #1
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Rep: Reputation: 16
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.
 
Old 04-15-2010, 07:04 AM   #2
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
have you checked

Code:
grep --color
If you are not using grep, what are you using to search the pattern?
 
Old 04-15-2010, 08:24 AM   #3
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Original Poster
Rep: Reputation: 16
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.
 
Old 04-15-2010, 08:43 AM   #4
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
Please elaborate your problem
 
Old 04-15-2010, 09:25 AM   #5
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Original Poster
Rep: Reputation: 16
Smile

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
 
Old 04-15-2010, 09:30 AM   #6
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
Code:
grep --color '11' file
 
Old 04-15-2010, 10:01 AM   #7
dina3e
Member
 
Registered: Mar 2008
Location: Bangalore
Distribution: Enterprise Red Hat linux
Posts: 98

Original Poster
Rep: Reputation: 16
Thanks for valuable answer.
But what about , if i go for awk and sed pattern matching.
 
Old 04-15-2010, 10:07 AM   #8
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
Even I have to look for it. Probably someone will help.
 
Old 04-15-2010, 10:43 AM   #9
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,425

Rep: Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Color registration bars on output: Lexmark C510 Color Laser printer spud_linux Linux - Hardware 2 10-06-2008 01:46 PM
REQ: Gimp plugin fo automatic color correction and color masks Rick069 Linux - Software 1 04-15-2007 04:10 PM
Using [code] inside of [color] results in very small text scuzzman LQ Suggestions & Feedback 1 03-28-2005 03:14 AM
PHP: changing row color showing mysql results emilioestevezz Programming 15 09-13-2004 07:27 PM
[COLOR=red]ENCORE WIRELESS PCI Card 802.11b [/COLOR] enrique145 Linux - Hardware 3 07-07-2004 03:31 PM


All times are GMT -5. The time now is 03:30 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration