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
deleting lines after pattern using sed larne Shell Programming and Scripting 2 10-13-2008 01:54 PM
comment/delete a particular pattern starting from second line of the matching pattern imas Shell Programming and Scripting 4 10-13-2008 03:37 AM
Delete a block of text delimited by blank lines when pattern is found gleu Shell Programming and Scripting 17 12-16-2007 11:30 PM
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

Closed Thread
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
  #1 (permalink)  
Old 11-14-2008
Ilja Ilja is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 22
Delete lines between two patterns without deleting the second pattern

I want to delete lines like this

Code:
sed '/FROM_HERE/,/TO_HERE/d'

but I would like to *not* delete the second match, i.e. the TO_HERE line. How can I achieve this?
Thank you!
  #2 (permalink)  
Old 11-14-2008
radoulov's Avatar
radoulov radoulov is online now Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,926

Code:
sed '/FROM_HERE/,/TO_HERE/{//p;d;}'

Closed Thread

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 09:04 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