Improved awkuniq alias and fixed some other bugs

This commit is contained in:
Random936
2025-02-27 18:28:10 -08:00
parent c059e55a57
commit 12f2d9e986
4 changed files with 12 additions and 3 deletions

View File

@@ -18,7 +18,6 @@
shellAliases = {
cd = "z";
ls = "eza";
awkuniq = "sort | uniq";
histogram = "awkuniq -c | sort -nr";
json-less = "jq -C . | less -R";
csv2json = "python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))'";
@@ -61,6 +60,15 @@
if [[ -n "$SSH_CONNECTION" && "$TERM" == "ghostty" ]]; then
export TERM="xterm-256color"
fi
awkuniq() {
if [[ "$1" == "-c" ]]; then
awk '{ !x[$0]++ } END { for (i in x) print x[i] "\t" i }'
else
awk '!x[$0]++'
fi
}
'';
plugins = [