Deleting lines in a flat file

Hi Friends
I have a flat file which has sentence like "Notice generated". It can be anywhere in the flat file.
What I want to do is, I want to delete all the lines which are above sentence "Notice generated".
How can I do it.
Kindly advice.
Anushree

Try this:

sed '/Notice generated/d' file

No the simple sed (nor the ubiquitous grep -v 'Notice generated' > newfile) would NOT do what anushree.a is asking for. Those commands would only get rid of the lines WITH those text tags.

His real question is "How to delete the lines above the text tag?", and does specify how many lines above his text search term.

I'm sure perl could do it, I'll play around and post my results.

hoping that 'Notice generated' comes once in the file and u want delete all the lines above it...

Try this...

sed '1,/Notice generated/d' youfile

A different approach (but conventional one) Might the famous sed one
liner -- Print 1 line of context before and after regexp, with
line number indicating where the regexp occurred this is
to (similar to "grep -A1 -B1").

sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h

Where '1' could be some other number.

Hey Malcomex999 and friends,
sed.... /d' filename worked perfectly.

Thank you very much for the guidance.
Take care and god bless you all.
Anushree