4 ms·
This is the most convenient solution. "sponge reads standard input and writes it out to the specified file. Unlike a shell redirect, sponge soaks up all its i
by TorKlingberg 17y ago
This is the most convenient solution.
"sponge reads standard input and writes it out to the specified file. Unlike a shell redirect, sponge soaks up all its input before opening the output file. This allows for constructing pipelines that read from and write to the same file."
I remember writing a script that did the same thing (in Perl or maybe it was Bash).