HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

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

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thecommandbeforewritingclisoakspongeinput

Problem

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

Solution

sponge — 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|--invert-match]}} '^{{#}}' {{path/to/file}} | sponge {{path/to/file}}

Code Snippets

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|--invert-match]}} '^{{#}}' {{path/to/file}} | sponge {{path/to/file}}

Context

tldr-pages: common/sponge

Revisions (0)

No revisions yet.