inserting a blank line in a file

From: Rich Glazier (RichGlazier@netscape.net)
Date: Tue Oct 21 2003 - 17:13:21 EDT


Tru64 5.1A PK5

Does anybody know how to insert a blank line above a specific occurance in a file, without using vi? As in the example file below, I want to insert a balnk line above every occurance of a line starting (or containing) "hello". I tried different itterations of tr, or sed, but most utilities deal with "lines following", not "lines prior".

change:

hello there
tru64 managers
my name is rich
glazier 1234 1234
hello there
tru64 managers
my name is rich
glazier1 12345 12345
hello there
tru64 managers
my name is rich
glazier2 12346 12346

to:

hello there
tru64 managers
my name is rich
glazier 1234 1234

hello there
tru64 managers
my name is rich
glazier1 12345 12345

hello there
tru64 managers
my name is rich
glazier2 12346 12346

__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge. Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:39 EDT