On Wed, 2004-12-15 at 03:01 +1100, Dan Treacy wrote:
> I have a text file that I'm trying to update from a shell script but the 
> information needs to be inserted at the beginning of the file.
> 
> I have a couple of ways to do this that involves lots of "cat"ing and 
> mving and temporary files and the like etc. Not real high on the 
> efficiency scale.

By the time you muck around it is far easier to do something like this:

echo SOMETEXT >newfile$$
echo "some more text and $VARIABLE" >> newfile$$
cat oldfile >> newfile$$
mv oldfile oldfile.bak
mv newfile$$ oldfile

If you consider what is happening with the filesystem anyway either you
do it or the OS does it so the result is the same.

-- 
Ken Foskey
OpenOffice.org developer


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to