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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find and delete the line gsusarla UNIX for Advanced & Expert Users 8 07-09-2008 05:15 PM
Find a word and delete the line gsusarla UNIX for Dummies Questions & Answers 1 04-02-2008 03:45 PM
sed - Replace Line which contains the Pattern match with a new line kousikan Shell Programming and Scripting 2 03-24-2007 07:24 AM
SED: match pattern & delete matched lines not4google Shell Programming and Scripting 7 11-22-2006 09:58 AM
How to delete lines do NOT match a pattern JumboGeng UNIX for Dummies Questions & Answers 1 09-20-2006 06:52 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-01-2006
cstovall cstovall is offline
Registered User
  
 

Join Date: Nov 2002
Location: Raleigh, N.C.
Posts: 78
sed: find match and delete the line above

I am searching a dhcpd.conf to find the hardware ethernet match, then once the match is found delete just the line above it. For example:

testmachine.example {
hardware ethernet 00:00:00:00:00:00;
fixed address 192.168.1.100;
next-server 192.168.1.101;
filename "linux-install/pxelinux.0";
}

I would like to use sed to remove "testmachine.example {".
I was going to create a two step process by removing the line above the harware ethernet match. Then remove the hardware ethernet match through }. However, if someone knows how to find the harware ethernet match and remove the whole block, I would be very appreciative.

There are multiple fixed addresses in this file, so it can only remove this block based on the hardware ethernet match.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0