Richard Adams wrote:

> On Sun, 16 Jan 2000,  Niclas Hedhman wrote about,  Scripting problems.:
> > If I have two files, 'abc' and 'def'
> >
> > and I do a
> >
> > cat abc def | more >def
>
> What you are doing is catting both files via more and a redirect with
> will overwrite the line over and over, use >> instaed of >
>
> > overwrites
> >> appends to the bottom of the file.

I know that.

> As to what you are trying to achive i cant imagen, why use "more" ??

I had no other clues...
cat  file1 file2 >file2
will tell you that the output file is an input file.
But using a redirect, the output of cat goes to a temporary file, and by
the time cat is done with the file as an input file, it can be written to.




> cat file1 >>file2
>
> Would be a beter way one would think.

No, because I need prepending. Contentent to  be added to the beginning,
not the end.


Now,  Lawson gave the accurate answer, as usual...

cat file1 file2 | cat >file2

works properly.


And for those who wonders what the heck I am doing, the full actual script
line look like...

echo '<tr><td><P STYLE="margin-bottom: 0in"><U><FONT
SIZE=+1>'$VERSION.$BUILD'</FONT></U></P><div
STYLE="position:relative;left:20"><a
href="binaries/'$PRODUCT-$VERSION.$BUILD'.tar.gz">Binaries</a><br><a
href="source/'$PRODUCT-$VERSION.$BUILD'-source.tar.gz">Source</a><br><a
href="'$VERSION.$BUILD'">Unzipped</a></DIV></td><td>'$TODAY'</td><td>'$COMMENT'</td></tr>'
| cat /dev/stdin /bali/products/$PRODUCT/archive/builds.log | cat
>/bali/products/$PRODUCT/archive/builds.log

I am creating a Log entry to be shown on my site, and I want the newest
entry first in that table.

I must again express my gratitude to all the people who has been involved
in developing the scripting capabilities and the other small little neat
utilities that works with streams. And if that would have been pushed a
bit harder, I would have gone Linux in the pre-1.0 times.  As a developer,
it is just about invaluable to have it.
I am now also, slowly, modifying the web content to be updated through
scripts. "This site is maintained with BASH."  Cute!!

Thanks again.
Niclas

Reply via email to