I'm failing to see the problem with loading everything into memory.
On 2 July 2013 15:39, Galos, David <galosd83_AT_students.rowan.edu> wrote:
>> It also sucks. avoiding a temporary file is the whole point to sponge.
>> otherwise:
>>
>> cat file | grep file > file_temp; mv file_temp file;
>
> Actually, it would be
> tmp = $(mktemp)
> grep 'foo' file > $tmp
> cat $tmp > file
>
> Not only that, but tmpfile(3) is safer with respect to race
> conditions. You'll notice that even moreutils sponge always opens a
> tempfile[1]. In fact, it's really stupid: first it fills up all your
> remaining memory then, it writes all of that to a tempfile, which if
> in a tmpfs-mounted /tmp will fail miserably.
>
>
> [1]: https://gitorious.org/moreutils/moreutils/blobs/master/sponge.c:283
>
Received on Tue Jul 02 2013 - 21:41:14 CEST