m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <m@m-chrzan.xyz>2021-04-09 11:36:27 +0200
committerMarcin Chrzanowski <m@m-chrzan.xyz>2021-04-09 11:36:27 +0200
commit418ee1a7616bb4c82dc18741dd093657768b1e76 (patch)
tree127005460a0e34758c0732ebfa639f2b56b7ec7e
parent0213efe43ebcf37efdabe8ae5f9cf3e338569941 (diff)
Add text utils sheet
-rw-r--r--text-utils.md29
1 files changed, 29 insertions, 0 deletions
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 <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