From 418ee1a7616bb4c82dc18741dd093657768b1e76 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Fri, 9 Apr 2021 11:36:27 +0200 Subject: Add text utils sheet --- text-utils.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 text-utils.md diff --git a/text-utils.md b/text-utils.md new file mode 100644 index 0000000..ed1e113 --- /dev/null +++ b/text-utils.md @@ -0,0 +1,29 @@ +# Various small text manipulation utilities + +## `cut` + +Select fields from each line based on some delimeter + + cut -d -f + +Setting a different output delimiter: + + --output-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 -- cgit v1.2.3