Dan Treacy wrote:
[EMAIL PROTECTED] wrote:
Ouch
a problem begging for perl as a solution! James
Probably, but seeing as though my shell skills are half a step above totally crap and my perl skills are 4 steps below shell it is :-)
And thanks everyone for your suggestions I haven't had a chance to test any of them out. maybe tonight.
Dan.
If you're talking about inserting text at the beginning of a file, than perl has a tidy way of doing it all for you:
$ perl -pi -e "s/^/foobar\n/ if ($.==1);" test.file
That's pretty easy!
See the 'perlrun' manpage.
Doesn't seem to work if test.file is empty ie 0 lines.
Nice variation where you can say '-i.orig' and you will have the original stored with a '.orig' extension, or whatever you want.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html