Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 9
    Thanks for the answer. As a possibly helpful addition, if you're using homebrew on Mac, can use brew install moreutils. Commented Feb 6, 2013 at 2:12
  • 7
    Or sudo apt-get install moreutils on Debian-based systems. Commented Aug 15, 2014 at 16:45
  • 7
    Word of caution, "sponge" is destructive, so if you have an error in your command, you can wipe out your input file (as I did the first time trying sponge). Make sure your command works, and/or the input file is under version control if you are trying to iterate on making the command work. Commented Dec 27, 2016 at 18:13
  • sudo yum install moreutils on rhel/centos/7, works on Fedora too Commented Jun 1, 2017 at 22:39
  • 1
    There's also a JavaScript implementation of sponge, here. Handy for package.json scripts and such. Commented Apr 8, 2018 at 13:25