Tac command outputs file in reversed order (thus its name - it’s “cat” but backwards). And sponge is a pure magical one which acts as some kind of buffer which gets all the output and then puts it into whatever file in one go, completely removing its contents (this is how I get it - may be wrong). So one could output modified contents of a file to this file itself as so:tac diamond.dat | sponge diamond.dat