[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a sed question



On Fri, Jan 25, 2002 at 03:13:22PM -0100, andrej hocevar wrote:
> Hello,
> can someone please tell me how to instruct sed to make an empty line
> before a certain pattern? For me, the same would be to make a new
> line every N lines. 
> Thank you.
> 
> e.g.
> <NEWLINE>
> Package: foo
> Pin: bar
> <NEWLINE>
> Package: ...
> 
> etc ...
> 

Contents of ~/addblank.sed :
--- cut here
/^Package:/ {
i \

}
--- cut here

Note that line 3 of the ~/addblank.sed is blank, but needed.

then 
$ sed -f ~/addblank.sed < somewhere

should do the trick for you..

For futher information:

$ man sed

:-)

-- 
Karl E. Jørgensen
karl@jorgensen.com
www.karl.jorgensen.com
Please study http://www.rfc855.org

Attachment: pgpmEMaLt4spy.pgp
Description: PGP signature


Reply to: