[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] RE: [linux-users] Replacing a block of text in a file with text
And Lo! The Great Prophet Matthew Collins uttered these words of wisdom:
> On Tue, Aug 10, 2004 at 04:23:19PM +0100, Ted Harding wrote:
> >
> > $ cat test.in | awk '{print $0} ; /zmatrix angstrom/{exit}' > output.txt
> > $ cat basis.txt >> output.txt
> > $ echo "end" >> output.txt
> >
>
> What about for a test.in file of
>
> Keep this
> zmatrix angstrom
> Get rid of this
> end
> Keep this as well
>
I thought about awk, but you'd have to write a filereader to getline a file
line-by-line, something which, given the four line sed solution, seems a little
OTT. A Perl solution would also suffer the same problem, I suspect.
Chris...
--
\ Chris Johnson \ NP: Electropop - 10. Godley & Creme - Und
\ cej [at] nightwolf.org.uk \ er Your Thumb
\ http://cej.nightwolf.org.uk/ \
\ http://redclaw.org.uk/ ~---------------------------------------
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.