SUMMARY: Removing lines after getting perticular text

Date: Mon Oct 08 2001 - 08:36:14 EDT
Thanx to those who replied so fast, all the answer were good 
Mentioning some of the good answers .......
First one is really good..........Answer are mentioned at the end
origianl question
Dear Gurus........ 
I need help on {awk ,sed, grep , egrep} 
I want single line command or small script which 
can do following thing........ I want to grep for 
perticular text i.e big file which contains a lot of text as below 
For e.g. my file is text1.txt which contains following lines 
I want help on sun pls help me 
Now I want to grep for all occurances of text "I want help on * pls help me"

and then I want that this line and 5 lines below it( which is not fixed
format of text) will be ommited and rest 
of the data I should be able to take in some other file. 
that is my new file for e.g. text2.txt should contain only 

Carsten B. Knudsen []

sed '/your-search-pattern/{N;N;N;N;N;d;}'
Andy Bach []
my $found_it = 0;
while (<>) {
  if ( /I want help on (.+) pls help me/ ) {
    $found_it ++;
    my $res = <> for 1 .. 5;
  print if $found_it;
Glass, David (UDB) []
awk '{ 
if(++s>5)print $0 
}' input_file > output_file
Dan Lowe []

"This e-mail message may contain confidential, proprietary or legally 
privileged information. It should not be used by anyone who is not the 
original intended recipient. If you have erroneously received this message, 
please delete it immediately and notify the sender. The recipient acknowledges 
that ICICI or its subsidiaries and associated companies (including ICICI Bank)
"ICICI Group", are unable to exercise control or ensure or guarantee the 
integrity of/over the contents of the information contained in e-mail 
transmissions and further acknowledges that any views expressed in this 
message are those of the individual sender and no binding nature of the 
message shall be implied or assumed unless the sender does so expressly with 
due authority of ICICI Group. Before opening any attachments please check them 
for viruses and defects." 

sunmanagers mailing list
Received on Mon Oct 8 07:38:02 2001

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:26 EST