Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Escaping the 'dot' in grep [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 499
Location: Texas

PostPosted: Tue Jun 25, 2013 9:25 pm    Post subject: Escaping the 'dot' in grep [Solved] Reply with quote

I was filtering out some domain entries using grep recently. We have some domains that look similar to this...

xyzsub1host1.sub1.domain.com
xyzsub2host2.sub2.domain.com
xyzsub1host3.sub1.domain.com
xyzsub3host4.sub3.domain.com
xyzsub1host5.sub1.domain.com
... and so on.

So I was grepping a list as such.

Code:
host -l domain.com | grep \.sub1\.

however the above still highlights the search like this...

xyzsub1host.sub1.domain.com
xyzsub1host3.sub1.domain.com
xyzsub1host5.sub1.domain.com


Update:
Nevermind, I quoted it :D
Code:
host -l domain.com | grep "\.sub1\."

I tried that at first but didn't work, must have typo'd something the first time.
_________________
Drinking from the fountain of knowldege.
Sometimes sipping.
Sometimes gulping.
Always thirsting.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7398
Location: Somewhere over Atlanta, Georgia

PostPosted: Tue Jun 25, 2013 10:07 pm    Post subject: Reply with quote

Code:
host -l domain.com | grep \\.sub1\\.
also works. ;)

- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum