The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Configuring snmpd.conf and snmptrapd.conf jagdish.machhi@ UNIX for Advanced & Expert Users 2 04-17-2008 12:01 PM
newsyslog.conf mirusnet UNIX for Advanced & Expert Users 1 02-24-2008 08:11 AM
how to delete entry in file "wtmpx"(/var/adm/wtmpx) arm_naja UNIX for Advanced & Expert Users 4 03-08-2006 01:00 AM
dhcpd.conf keliy1 Linux 1 11-17-2004 01:05 PM
dns and resolv.conf b03der UNIX for Dummies Questions & Answers 10 07-26-2002 01:34 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-21-2007
Registered User
 

Join Date: Nov 2007
Posts: 2
delete dhcp.conf entry using sed

I am trying to use sed to remove entries from my dhcpd.conf file.

The form of the file is:


Code:
host foo {
        option 1
        option 2
}

host bar {
       option 1
       option 2
}
I was trying to use a label like:

Code:
 sed -e :a -e "s/^host bar {[^}]*//g;/{/N;//ba" /etc/dhcpd.conf
I want to delete every from "host bar" to the "}".

Any thoughts?
Reply With Quote
Forum Sponsor
  #2  
Old 11-21-2007
Moderator
 

Join Date: Feb 2007
Posts: 2,329
Code:
sed '/host bar {/,/}/d' /etc/dhcpd.conf
Regards
Reply With Quote
  #3  
Old 11-26-2007
Registered User
 

Join Date: Nov 2007
Posts: 2
Many thanks.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0