>But if you do
>
> cat file | sort > file
>
>This will work just fine.
Um, maybe for "sort", but if you're claiming that this approach
extends to I/O redirection in general, then I claim that you're
living dangerously. A convincing demonstration might start with
(a sacrificial copy of) a Big File(tm) ie. larger than 1Mb.
If you were then to say
cat myBigFile | cat >myBigFile
ls -l myBigFile
...you would see that it's become dramatically Less Big(tm) and
(in my experience) is very likely to have been truncated down
either to zero or to a size that is one of those Suspicious Powers
Of 2(tm), probably reflecting some obscure internal characteristic
of the underlying filesystem implementation. I used cat instead
of sort here because sort typically buffers its input in memory
(or temp files) until it's seen and processed it all, which can
obscure the point being illustrated here.
Moral: in general, don't open the same file for input and output.
**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************