aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-05-01 15:40:47 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-05-01 15:40:47 +0200
commit10d1d2a6124935e5ec9d76e50f67df8f582e112f (patch)
tree23438dbcd2e2bce2e3eec1608a588f52f0247ad5
parent1b997955d4baf2f22890b2deda74480d5654e487 (diff)
downloadnotes-10d1d2a6124935e5ec9d76e50f67df8f582e112f.tar.gz
notes-10d1d2a6124935e5ec9d76e50f67df8f582e112f.zip
tr: add notes
-rw-r--r--src/SUMMARY.md1
-rw-r--r--src/cli/README.md1
-rw-r--r--src/cli/tr.md39
3 files changed, 41 insertions, 0 deletions
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index e770c09..24c679f 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -12,6 +12,7 @@
- [sed](./cli/sed.md)
- [column](./cli/column.md)
- [sort](./cli/sort.md)
+ - [tr](./cli/tr.md)
- [Tools](./tools/README.md)
- [tmux](./tools/tmux.md)
diff --git a/src/cli/README.md b/src/cli/README.md
index 53c64b7..2625899 100644
--- a/src/cli/README.md
+++ b/src/cli/README.md
@@ -4,3 +4,4 @@
- [sed](./sed.md)
- [column](./column.md)
- [sort](./sort.md)
+- [tr](./tr.md)
diff --git a/src/cli/tr.md b/src/cli/tr.md
new file mode 100644
index 0000000..a878924
--- /dev/null
+++ b/src/cli/tr.md
@@ -0,0 +1,39 @@
+# tr(1)
+
+```
+tr [opt] str1 [str2]
+ -d delete characters in str1
+ -s squeeze repeating sequence of characters in str1
+```
+
+## Examples
+
+### To lower
+```sh
+echo MoOsE | tr '[:upper:]' '[:lower:]'
+# output: moose
+```
+
+### Replace characters
+```sh
+echo moose | tr 'o' '-'
+# output: m--se
+
+echo moose | tr 'os' '-'
+# output: m---e
+```
+
+### Remove specific characters
+```sh
+echo moose | tr -d 'o'
+# output: mse
+
+echo moose | tr -d 'os'
+# output: me
+```
+
+### Squeeze character sequences
+```sh
+echo moooooossse | tr -s 'os'
+# output: mose
+```