diff --git a/knowledge base/sort.md b/knowledge base/sort.md new file mode 100644 index 0000000..161396e --- /dev/null +++ b/knowledge base/sort.md @@ -0,0 +1,17 @@ +# Sort + +## TL;DR + +```shell +# Sort all given lines. +sort path/to/file + +# Sort all lines reverse. +sort -r path/to/file + +# Sort lines numerically. +sort -n path/to/file + +# Sort lines and remove duplicates. +sort -u path/to/file +``` diff --git a/knowledge base/uniq.md b/knowledge base/uniq.md new file mode 100644 index 0000000..1f690a6 --- /dev/null +++ b/knowledge base/uniq.md @@ -0,0 +1,20 @@ +# Uniq + +## TL;DR + +```shell +# Print all but duplicates lines. +uniq path/to/file + +# Only print unique lines. +uniq -u path/to/file + +# Only print repeating lines. +uniq -d path/to/file + +# Count unique lines only. +uniq -cu path/to/file + +# Count duplicated lines only. +uniq -cd path/to/file +```