m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/text-utils.md
diff options
context:
space:
mode:
Diffstat (limited to 'text-utils.md')
-rw-r--r--text-utils.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/text-utils.md b/text-utils.md
new file mode 100644
index 0000000..eb801e7
--- /dev/null
+++ b/text-utils.md
@@ -0,0 +1,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