sponge

Soak up the input before writing the output file. More information: <https://manned.org/sponge>.

Install

All systems
curl cmd.cat/sponge.sh
Debian Debian
apt-get install moreutils
Ubuntu
apt-get install moreutils
Arch Arch Linux
pacman -S moreutils
image/svg+xml Kali Linux
apt-get install moreutils
Fedora
dnf install moreutils
Windows (WSL2)
sudo apt-get update sudo apt-get install moreutils
OS X
brew install moreutils
Raspbian
apt-get install moreutils

Soak up the input before writing the output file. More information: <https://manned.org/sponge>.

  • Append file content to the source file:
    cat path/to/file | sponge -a path/to/file
  • Remove all lines starting with # in a file:
    grep -v '^#' path/to/file | sponge path/to/file

© tl;dr; authors and contributors