1SPONGE(1) moreutils SPONGE(1)
2
3
4
6 sponge - soak up standard input and write to a file
7
9 sed '...' file | grep '...' | sponge [-a] file
10
12 sponge reads standard input and writes it out to the specified file.
13 Unlike a shell redirect, sponge soaks up all its input before writing
14 the output file. This allows constructing pipelines that read from and
15 write to the same file.
16
17 sponge preserves the permissions of the output file if it already
18 exists.
19
20 When possible, sponge creates or updates the output file atomically by
21 renaming a temp file into place. (This cannot be done if TMPDIR is not
22 in the same filesystem.)
23
24 If the output file is a special file or symlink, the data will be
25 written to it, non-atomically.
26
27 If no file is specified, sponge outputs to stdout.
28
30 -a
31 Replace the file with a new file that contains the file's original
32 content, with the standard input appended to it. This is done
33 atomically when possible.
34
36 Colin Watson and Tollef Fog Heen
37
38
39
40moreutils 2006-02-19 SPONGE(1)