m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/text-utils.md
blob: eb801e75f54ae3f67130a74556b19327598e48c4 (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
30
31
32
33
34
35
# 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`.

So intersection of two files:

    comm -12 file1 file2

## `diff`

Side by side:

    diff -y