Sample Header Ad - 728x90

Is there a standard alternative to sponge to pipe a file into itself?

14 votes
4 answers
5272 views
I frequently want to do something like this: cat file | command > file (which obviously doesn't work). The only solution I've seen for this is sponge, i.e. cat file | command | sponge file Unfortunately, sponge is not available to me (nor can I install it or any other package). Is there a more standard quick way to do this without having to break it up every time into multiple commands (pipe to temp file, pipe back to original, delete temp file)? I tried tee for example, and it seems to work, but is it a consistent/safe solution?
Asked by argentum2f (303 rep)
Sep 24, 2019, 10:45 PM
Last activity: Oct 20, 2023, 01:31 PM