Re: [SLUG] Insert text at the beginning of a file

2004-12-14 Thread Peter Chubb
> "Robert" == Robert Thorsby <[EMAIL PROTECTED]> writes: Robert> On 2004.12.15 10:10 Roger Barnes wrote: >> I'm trying to think of a way that doesn't use an intermediate file, >> not that it would be any more efficient given the whole file will >> be re-written no matter what you do. I tried

Re: [SLUG] Insert text at the beginning of a file

2004-12-14 Thread Robert Thorsby
On 2004.12.15 10:10 Roger Barnes wrote: I'm trying to think of a way that doesn't use an intermediate file, not that it would be any more efficient given the whole file will be re-written no matter what you do. I tried using less with unlimited memory buffers (-b-1) instead of cat, but it doesn't

Re: [SLUG] Insert text at the beginning of a file

2004-12-14 Thread Michael Lake
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 effici

Re: [SLUG] Insert text at the beginning of a file

2004-12-14 Thread O Plameras
Dan Treacy wrote: G'Day sluggers, 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 hig

RE: [SLUG] Insert text at the beginning of a file

2004-12-14 Thread Roger Barnes
> tac is the opposite to cat > maybe something like > tac text.txt > reversed > echo "the line to insert" >> reversed > tac reversed > text.txt I was trying to do something like that too, but came up with another way that I suspect is more efficient than reversing files ... ech

Re: [SLUG] Insert text at the beginning of a file

2004-12-14 Thread Ken Foskey
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 a

Re: [SLUG] Insert text at the beginning of a file

2004-12-14 Thread Robert Thorsby
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