mirror of
https://github.com/xmengnet/the-art-of-command-line.git
synced 2024-12-24 04:16:29 +08:00
Add note about sort -u.
Addresses #27 and #63 while preserving clarity.
This commit is contained in:
parent
f65245236f
commit
a44c628ad2
1 changed files with 1 additions and 1 deletions
|
@ -235,7 +235,7 @@ Scope:
|
|||
|
||||
A few examples of piecing together commands:
|
||||
|
||||
- It is remarkably helpful sometimes that you can do set intersection, union, and difference of text files via `sort`/`uniq`. Suppose `a` and `b` are text files that are already uniqued. This is fast, and works on files of arbitrary size, up to many gigabytes. (Sort is not limited by memory, though you may need to use the `-T` option if `/tmp` is on a small root partition.) See also the note about `LC_ALL` above.
|
||||
- It is remarkably helpful sometimes that you can do set intersection, union, and difference of text files via `sort`/`uniq`. Suppose `a` and `b` are text files that are already uniqued. This is fast, and works on files of arbitrary size, up to many gigabytes. (Sort is not limited by memory, though you may need to use the `-T` option if `/tmp` is on a small root partition.) See also the note about `LC_ALL` above and `sort`'s `-u` option (left out for clarity below).
|
||||
```sh
|
||||
cat a b | sort | uniq > c # c is a union b
|
||||
cat a b | sort | uniq -d > c # c is a intersect b
|
||||
|
|
Loading…
Reference in a new issue