On 2004.12.15 03:01 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.

So seeing as my scripting pretty much blows and it's been more than a day since we've had a my one-line-script-is-better-than-yours-fest I thought I'd put it to the masses.

shell (bash) solutions prefered. perl if you REALLY must :-)

Try the "i" option in sed or the "BEGIN" option in awk. In sed each newline except the last must be escaped. In awk each shell variable must be declared as a switch.


HTH,
Robert Thorsby
--
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