prepend to a file with sponge from moreutils
April 17th, 2008
A few weeks I wrote about a tool, which helps you easily prepend to a file. I submitted prepend to moreutils and Joey was kind enough to point out this could be done with `sponge’. sponge reads standard input and when done, writes it to a file:
Probably the most general purpose tool in moreutils so far is
sponge(1), which lets you do things like this:
% sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd
Two days ago Joey released version 0.29 of moreutils including a patch by yours truly (with much help from Joey).
sponge: Handle large data sizes by using a temp file rather than by consuming arbitrary amounts of memory. Patch by Brock Noland. version 0.29 changelog
Also, on a non-command line note, I found a video on Joey’s site which I thought was pretty cool, Joey Learns to Fly.


April 17th, 2008 at 2:50 pm
[...] The code that led me to create this project was a command I am calling prepend 1.1. (UPDATE: See this post on sponge as its a better general case [...]
June 24th, 2008 at 11:42 am
[...] prepend to a file with sponge from moreutils [...]
November 11th, 2008 at 10:20 am
you talk about ’sponge’, curious, I fail to find a http://bashcurescancer.com/man/cmd/sponge or an entry in the list of command names beginning with ‘S’.
January 14th, 2010 at 7:31 pm
…
Однако …
January 19th, 2010 at 7:27 pm
…
Хм …