1 |
Am 09.09.2010 20:25, schrieb Andrea Conti: |
2 |
> Note however (this is the "it depends" part :) that piping does not |
3 |
> affect whatever the programs might allocate or save internally: in your |
4 |
> second example (which does not involve any disk writing in either case) |
5 |
> "sort" needs to see the complete input before producing any output, so |
6 |
> it will allocate enough memory to store it whether it is invoked alone |
7 |
> or as part of a pipeline (in which case it will also stall the |
8 |
> downstream pipeline section until the upstream pipe is closed). |
9 |
> |
10 |
|
11 |
When you look closer at `sort`, it is actually a quite impressive tool. |
12 |
It sorts in-memory for small amounts of data and switches to temporary |
13 |
files for larger. It can even compress those files to save disk space. |
14 |
|
15 |
And it is still faster than most "business-grade" software for importing |
16 |
data into data warehouses. |
17 |
|
18 |
Throw `cut`, `paste`, `join` and `grep` into the mix and you can build |
19 |
your own relational database system based on shell scripts ;) |