Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding # to begin of certain lines .. but .. 1

Status
Not open for further replies.

RFC1795

IS-IT--Management
Feb 13, 2003
76
US
Hi all,

I'm trying to hash out certain entries in socks.conf files on a few unix boxes .. I thought a simple script that would go to each box, check the file for any entries that had the following type string: sockd @=blah.at.me 0.0.0.0 0.0.0.0 eq whatever and would then pop a hash in the front.

I thought it would be simple ;-)

I tried the following approach:
sed 's/^sockd \(.*\) 0.0.0.0 0.0.0.0/#sockd 0.0.0.0 0.0.0.0/' socks.conf

Obviously the problem is the replaced text excludes the wildcard stuff that I need.

In the above sample each box would have a different domain name where the (.*\) is .. this still needs to be there.

Any clues as to what approach I should take here?

Thanks .. TJ
 
You can do :

sed -e '/^sockd .*0.0.0.0 0.0.0.0/s/^/#/' socks.conf

Jean Pierre.
 
Excellent!! Thanks .. that did the trick.
It's simple .. if you know how ;-)

Cheers .. TJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top