Oh! Okay! I didn't know that '>' operator works like this. I didn't know
either "sponge" command. Thank you very much guys!
2017-03-28 18:06 GMT+02:00 Bishop Bettini :
> On Tue, Mar 28, 2017 at 7:13 AM, Ismael Cama > >
>> wrote:
>>
>> >
>
> On Tue, Mar 28, 2017 at 7:13 AM, Ismael Cama >
> wrote:
>
> > When you try to sort a file and write the result in the same file, all
> the
> > contents are deleted. Example:
> >
> > sort foo.txt > foo.txt
> >
>
On Tue, Mar 28, 2017 at 9:30 AM, Michael Speer
This isn't a bug in sort. The ">" redirection operator in your shell opens
and truncates the file to ready it for output before your shell invokes
sort. After sort starts running and opens and reads the foo.txt file, it
finds that empty file and outputs nothing, as you would expect if you had
Hi,
> Am 28.03.2017 um 13:13 schrieb Ismael Cama :
>
> When you try to sort a file and write the result in the same file, all the
> contents are deleted. Example:
>
> sort foo.txt > foo.txt
This happens as the bash opens and resets the output before anything is
When you try to sort a file and write the result in the same file, all the
contents are deleted. Example:
sort foo.txt > foo.txt