m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/text-utils.md
blob: ed1e113b8caa12ad575485a2e2f5e13f3f33c256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Various small text manipulation utilities

## `cut`

Select fields from each line based on some delimeter

    cut -d <delimiter> -f <list of fields>

Setting a different output delimiter:

    --output-delimiter <delimiter>

## `comm`

    comm file1 file2

Outputs three columns:

1. Lines unique to `file1`
2. Lines unique to `file2`
3. Lines in both files

Assumes files are sorted.

Suppress a column with e.g. `-1`.

### Intersection of two files

    comm -12 file1 file2