m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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