One typo that's easy to make is:
sort file.txt | sponge > file.txt
(i.e., using redirection rather than passing the path as an argument to sponge)This is wrong and will not work! I've been bitten by it before.