aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cli/tr.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/tr.md')
-rw-r--r--src/cli/tr.md39
1 files changed, 39 insertions, 0 deletions
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
+```