| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
|
| 3 |
<!-- |
| 4 |
|
| 5 |
Copyright © 2006 Joey Hess |
| 6 |
|
| 7 |
This program is free software; you can redistribute it and/or |
| 8 |
modify it under the terms of the GNU General Public License |
| 9 |
version 2 as published by the Free Software Foundation. |
| 10 |
|
| 11 |
This program is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with this program; if not, write to the Free Software |
| 18 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 19 |
USA |
| 20 |
|
| 21 |
--> |
| 22 |
|
| 23 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN" |
| 24 |
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" |
| 25 |
[]> |
| 26 |
|
| 27 |
<refentry> |
| 28 |
|
| 29 |
<refentryinfo> |
| 30 |
<author> |
| 31 |
<firstname>Joey</firstname> |
| 32 |
<surname>Hess</surname> |
| 33 |
</author> |
| 34 |
<date>2006-02-19</date> |
| 35 |
</refentryinfo> |
| 36 |
|
| 37 |
<refmeta> |
| 38 |
<refentrytitle>sponge</refentrytitle> |
| 39 |
<manvolnum>1</manvolnum> |
| 40 |
<refmiscinfo class="manual">moreutils</refmiscinfo> |
| 41 |
<refmiscinfo class="source">moreutils</refmiscinfo> |
| 42 |
</refmeta> |
| 43 |
|
| 44 |
<refnamediv> |
| 45 |
<refname>sponge</refname> |
| 46 |
<refpurpose>soak up standard input and write to a file</refpurpose> |
| 47 |
</refnamediv> |
| 48 |
|
| 49 |
<refsynopsisdiv> |
| 50 |
<cmdsynopsis> |
| 51 |
<command>sed '...' file | grep '...' | sponge [-a] file</command> |
| 52 |
</cmdsynopsis> |
| 53 |
</refsynopsisdiv> |
| 54 |
|
| 55 |
<refsect1> |
| 56 |
<title>DESCRIPTION</title> |
| 57 |
|
| 58 |
<para><command>sponge</command> reads standard input and |
| 59 |
writes it out to the specified file. Unlike a shell |
| 60 |
redirect, <command>sponge</command> soaks up all its input before |
| 61 |
writing the output file. This allows constructing |
| 62 |
pipelines that read from and write to |
| 63 |
the same file. |
| 64 |
</para> |
| 65 |
<para> |
| 66 |
<command>sponge</command> preserves the |
| 67 |
permissions of the output file |
| 68 |
if it already exists. |
| 69 |
</para> |
| 70 |
<para> |
| 71 |
When possible, <command>sponge</command> creates or updates the |
| 72 |
output file atomically by renaming a temp |
| 73 |
file into place. (This cannot be done |
| 74 |
if TMPDIR is not in the same filesystem.) |
| 75 |
</para> |
| 76 |
<para> |
| 77 |
If the output file is a special file or symlink, |
| 78 |
the data will be written to it, non-atomically. |
| 79 |
</para> |
| 80 |
<para> |
| 81 |
If no file is specified, <command>sponge</command> outputs to |
| 82 |
stdout. |
| 83 |
</para> |
| 84 |
</refsect1> |
| 85 |
|
| 86 |
<refsect1> |
| 87 |
<title>OPTIONS</title> |
| 88 |
|
| 89 |
<variablelist> |
| 90 |
|
| 91 |
<varlistentry> |
| 92 |
<term><option>-a</option></term> |
| 93 |
<listitem> |
| 94 |
<para> |
| 95 |
Replace the file |
| 96 |
with a new file that contains |
| 97 |
the file's original content, |
| 98 |
with the standard input |
| 99 |
appended to it. This is done |
| 100 |
atomically when possible. |
| 101 |
</para> |
| 102 |
</listitem> |
| 103 |
</varlistentry> |
| 104 |
|
| 105 |
</variablelist> |
| 106 |
</refsect1> |
| 107 |
|
| 108 |
<refsect1> |
| 109 |
<title>AUTHOR</title> |
| 110 |
<para> |
| 111 |
Colin Watson and Tollef Fog Heen |
| 112 |
</para> |
| 113 |
</refsect1> |
| 114 |
</refentry> |