Inserting Blank Line into File (sed/awk/?)

Root Boy Jim rbj at uunet.UU.NET
Thu Mar 28 11:27:13 AEST 1991


>In article <ED.91Mar15201957 at lvw6.lvw.loral.com> ed at lvw6.lvw.loral.com (Ed Allen) writes:
>>Now for the 'sed' solution....
>>sed -n -e '{N;N;p;a\
>>
>>}' filename

Most of it anyway. Works if the number of lines is a multiple of three.
Extra line or two gets eaten.

Anyway, here's a single line solution without the same bug:

	sed -n -e '$p;N;$p;N;h;s/.*//;H;x;p'

I think TC is right about avoiding sed in cases like this.
-- 
		[rbj at uunet 1] stty sane
		unknown mode: sane



More information about the Comp.unix.questions mailing list