From 6c89dab6163c04ef0ab19472b46dacccc082ee46 Mon Sep 17 00:00:00 2001 From: Kjell Kvinge Date: Wed, 17 Jun 2015 16:44:07 +0200 Subject: [PATCH 1/2] add description and example of sponge --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 5840e2f..1f92078 100644 --- a/README.md +++ b/README.md @@ -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 From 8cb7fd9722634e4a8740b7c02ddc614bc534630d Mon Sep 17 00:00:00 2001 From: Kjell Kvinge Date: Wed, 17 Jun 2015 22:07:27 +0200 Subject: [PATCH 2/2] explain use of alias. --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index e4895b6..76fcdad 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,11 @@ Scope: - For a simple web server for all files in the current directory (and subdirs), available to anyone on your network, use: `python -m SimpleHTTPServer 7777` (for port 7777 and Python 2). +- `alias` - when you have some favirite commands you write a lot. example: + ```bash + alias myproc='ps aux | grep username' + ``` + After this, just type: myproc ## Processing files and data