sponge
« Back to VersTracker
Description:
Soak up standard input and write to a file
Type: Formula  |  Tracked Since: Dec 28, 2025
Links: Homepage  |  formulae.brew.sh
Category: Developer tools
Tags: shell cli utils text-processing moreutils
Install: brew install sponge
About:
Sponge soaks up all standard input and writes it to a specified file. This is particularly useful when you need to modify a file in-place using shell redirection, as it prevents the shell from clobbering the file before the command reads it. It acts as a buffer, ensuring data integrity during complex stream manipulations.
Key Features:
  • Buffers standard input completely before writing
  • Prevents file clobbering during in-place edits
  • Simplifies complex shell redirection pipelines
  • Part of the reliable moreutils suite
Use Cases:
  • Editing files in-place with sed: `sed 's/foo/bar/' file | sponge file`
  • Capturing noisy command output for later analysis
  • Breaking circular dependencies in shell pipes
Alternatives:
  • tmpfile – Manual creation of temporary files is more verbose and error-prone
  • sed -i – Native in-place editing works for simple cases but fails on complex pipelines
Version History
Detected Version Rev Change Commit
Sep 15, 2025 9:41am 0 VERSION_BUMP 5b30de38
Sep 10, 2024 11:26pm 0 VERSION_BUMP b2d23dc8
Nov 29, 2023 2:56pm 0 VERSION_BUMP 5b198c76
Sep 25, 2023 12:30am 0 VERSION_BUMP 2e03fd36