The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
how to remove specific lines from a file (reprise) gogol_bordello Shell Programming and Scripting 7 07-10-2008 01:04 PM
How to remove the specific lines from file using perl dipakg Shell Programming and Scripting 4 06-11-2008 03:45 AM
remove specific lines from flat file using perl meghana Shell Programming and Scripting 12 02-12-2008 09:50 PM
how to remove specific lines from a file bluemoon1 Shell Programming and Scripting 17 10-07-2007 11:40 PM
remove specific lines from a file hcclnoodles Shell Programming and Scripting 14 09-07-2006 01:31 PM

 
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 05-08-2009
Shoeless_Mike Shoeless_Mike is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 11
Sed or Awk to remove specific lines

I have searched the forum for this - forgive me if I missed a previous post.

I have the following file:

blah blah blah
blah blah blah
blah blah blah
blah blah blah
blah blah blah

alter table "informix".esc_acct add constraint (foreign key (fi_id)
references "informix".fi constraint "informix".fk_esc_acct_from_fi);
EOF

I want to use sed or awk to remove the 'alter table' statement which in this example is two lines, it can be three or even four lines. I know how to remove one line with sed but I do not know how to tell sed "remove the line with the words 'foreign key' and continue removing lines up to and including the first ';' that you run into". These lines do not always appear at the end of the file. I am using KSH on a Solaris 10 box.

Thanks for any help,

Mike
 

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 10:12 PM.


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