add description and example of sponge

pull/60/head
Kjell Kvinge 2015-06-17 16:44:07 +02:00
parent 92ef5bd205
commit 6c89dab616
1 changed files with 12 additions and 0 deletions

View File

@ -247,6 +247,18 @@ A few examples of piecing together commands:
awk '{ x += $3 } END { print x }' myfile
```
- `sponge`: from moreutils - soak up standard input and write to a file. I you want to change a file that is the source of a pipline: Instead of:
```bash
cat file | sort | uniq | iconv -f utf8 -t latin1 > /tmp/file && mv /tmp/file file
```
You can do:
```bash
cat file | sort | uniq | iconv -f utf8 -t latin1 | sponge file
```
- If want to see sizes/dates on a tree of files, this is like a recursive `ls -l` but is easier to read than `ls -lR`:
```sh
find . -type f -ls