delete dhcp.conf entry using sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting delete dhcp.conf entry using sed
# 1  
Old 11-21-2007
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?
# 2  
Old 11-21-2007
Code:
sed '/host bar {/,/}/d' /etc/dhcpd.conf

Regards
# 3  
Old 11-26-2007
Many thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Changes in dhcpd.conf do not make a difference in DHCP service behaviour

Hi Experts, Our DHCP server currently answers the DHCP Discover requests from ServerX. In our dhcpd.conf file there are parameters defined for ServerX. Now we introduced some additional Servers into the network and want them to get service from the same DHCP server. Similar configuration... (13 Replies)
Discussion started by: ekorgur
13 Replies

2. Shell Programming and Scripting

How to replace multiple "&nbsp;" entry with in <td> tag into single entry using sed?

I have the input file like this. Input file: 12.txt 1) There are one or more than one <tr> tags in same line. 2) Some tr tags may have one <td> or more tna one <td> tags within it. 3) Few <td> tags having "<td> &nbsp; </td>". Few having more than one "&nbsp;" entry in it. <tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies

3. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

4. Shell Programming and Scripting

Shell Script to check dhcp conf file

Hi, I have to prepare a script to check the dhcp conf file. The script has to check for a specific parameter called circuit ID. If the Circuit ID is unique it should show the output that it is unique and if it is duplicate it should show that the Circuit ID is duplicate. I have prepared the... (4 Replies)
Discussion started by: Crazy_Nix
4 Replies

5. Shell Programming and Scripting

Conf file entry.

Hi, Lets say I have a script which reads a conf file (say MASTERFILE) line by line to fetch file_name, source_path, dest_path. But currently, here the file name are static for eg: ABC.txt or XYZ.txt. So i have hard-coded in the conf file. So what happens that the script picks up the file_name... (1 Reply)
Discussion started by: amit.mathur08
1 Replies

6. Solaris

Want to know about a entry in syslog.conf

Hi Everyone, I just wanted to know about the below entry in syslog.conf in Solaris 10: kern.notice @destserver Now the log will be redirected to destserver. But I want to know the location on the destserver where this log will be thrown. Thanks in Advance, Deepak (4 Replies)
Discussion started by: naw_deepak
4 Replies

7. Shell Programming and Scripting

Delete Blank Lines Between DHCP Host Blocks

Hi All, I have a dhcpd.conf file that gets static hosts added and removed via a shell script. After sometime, there becomes huge gaps of space ( blank lines ) between each host block. I tried a couple of sed one-liners; but, I can't seem to get the output I'm looking for. Also, I would like... (4 Replies)
Discussion started by: cstovall
4 Replies

8. Shell Programming and Scripting

delete entry from /etc/hosts file ?

Hi there I have a requirement where i have to globally remove a hosts file entry from all boxes e.g. 10.01.10.1 my_server1 normally for 'in-line' editing of files without passing it out to another fle and copying it back etc which is messy, Ive been using the fantastic "perl -pi... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

9. Solaris

Solaris Install over WAN(where to keep wanboot.conf file for DHCP client)

I am trying to configure my jumpstart server to install Solaris 10 on a T1000 machine(target) over WAN. I do not know the IP address of the client, i wish the client to get the IP address from DHCP. how do i configure my /etc/netboot hierarchy. One option would be to keep the wanboot.conf in... (1 Reply)
Discussion started by: hemalsid
1 Replies
Login or Register to Ask a Question