"Have you ever wanted to process a file through a pipeline and write the output back to the file?"
Personally, no. I prefer to output text processsing results to a different file, maybe a temporary one, then replace the first file with the second file after looking at the second file.
awk '{do_stuff()}' 1.txt | sort -u | column --table > 2.txt
less 2.txt
mv 2.txt 1.txt
With this sponge program I cannot check the second file before replacing the first one. The only reason I can think of not to use a second file is if I did not have enough space for the second file. In that case, I would use a fifo as the second file. (I would still look at the fifo first before overwriting the first file.) mkfifo 1.fifo
awk '{do_stuff()}' 1.txt | sort -u | column --table > 1.fifo &
less -f 1.fifo
awk '{do_stuff()}' 1.txt | sort -u | column --table > 1.fifo &
cat 1.fifo > 1.txt