Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Meh, I was hoping for at least semi obscure things like the 'moreutils' utils.

Speaking of which, many people don't know about the 'moreutils' utils. Check them out ;)




I see sponge is somehow useless, how is `| sponge /etc/passwd` different from `> /etc/passwd`.


The redirect happens before the command is executed, so if you're trying to read from /etc/passwd, it's already been overwritten. Sponge will buffer the output and write the file after the first command has executed.


Ah, excuse my ignorance.


He explained it on the site - if you are trying to use grep to trim contents from a file and output them to the same file, you will end up with an empty file.

Seriously though - everyone knows this. Just use a temp file.

He says sponge "keeps the results in memory" - that's a problem if the file is huge.

Plus there are other tools to do in-place replacement.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: