aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-08-27 22:31:37 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-08-27 22:31:37 +0200
commitf5178ed1e419cfae7679ae8b4d3130ef48abfbfd (patch)
tree2dce06a0ef852a456959555801590359d96fd8e5
parentfa9e907965d9bf86eb2aa840a3bd9982699ee54c (diff)
downloadnotes-f5178ed1e419cfae7679ae8b4d3130ef48abfbfd.tar.gz
notes-f5178ed1e419cfae7679ae8b4d3130ef48abfbfd.zip
cli: add tac, paste
-rw-r--r--src/SUMMARY.md2
-rw-r--r--src/cli/README.md2
-rw-r--r--src/cli/paste.md22
-rw-r--r--src/cli/tac.md12
4 files changed, 38 insertions, 0 deletions
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index dc2e8bd..0fddc44 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -13,6 +13,8 @@
- [column](./cli/column.md)
- [sort](./cli/sort.md)
- [tr](./cli/tr.md)
+ - [tac](./cli/tac.md)
+ - [paste](./cli/paste.md)
- [Tools](./tools/README.md)
- [tmux](./tools/tmux.md)
diff --git a/src/cli/README.md b/src/cli/README.md
index 2625899..5eac7cb 100644
--- a/src/cli/README.md
+++ b/src/cli/README.md
@@ -5,3 +5,5 @@
- [column](./column.md)
- [sort](./sort.md)
- [tr](./tr.md)
+- [tac](./tac.md)
+- [paste](./paste.md)
diff --git a/src/cli/paste.md b/src/cli/paste.md
new file mode 100644
index 0000000..114002c
--- /dev/null
+++ b/src/cli/paste.md
@@ -0,0 +1,22 @@
+# paste(1)
+
+```
+# Concatenate input files linewise and join them by a TAB char.
+
+paste FILE [FILE]
+ -d CHAR delimiter to join each line
+```
+
+# Examples
+
+```sh
+# Read two files.
+paste <(echo -e 'a1\na2') <(echo -e 'b1\nb2')
+a1 b1
+a2 b2
+
+# Can read from stdin.
+echo -e 'a1 a2\nb1 b2\nc1 c2\nd1 d2' | paste - -
+# a1 a2 b1 b2
+# c1 c2 d1 d2
+```
diff --git a/src/cli/tac.md b/src/cli/tac.md
new file mode 100644
index 0000000..eba42ba
--- /dev/null
+++ b/src/cli/tac.md
@@ -0,0 +1,12 @@
+# tac(1)
+
+```sh
+# Reverse output lines of file(s) and concatenate (reverse of cat).
+tac FILE [FILE]
+
+echo -e 'aa\nbb\ncc\ndd' | tac
+# dd
+# cc
+# bb
+# aa
+```