Daily tip

Is there any tool to read from a file and then write to it in the same command line through a pipe?

Yes, sponge from the package moreutils.