diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-11-22 19:41:48 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-11-22 19:52:05 +0100 |
commit | 11f3ccd8c545c889821adcc0b1a7fc06fb833503 (patch) | |
tree | 5f5349a6ef8e6d9a8b726c847d7351758f2a266d /.local/bin/uni | |
parent | d9558178e273a82c24d7062a5b61c9266449e63b (diff) |
uni: Big performance improvements
Diffstat (limited to '.local/bin/uni')
-rwxr-xr-x | .local/bin/uni | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/.local/bin/uni b/.local/bin/uni index d0dbc36..778d2eb 100755 --- a/.local/bin/uni +++ b/.local/bin/uni @@ -14,15 +14,16 @@ setup() /^[^;]*;</d /Compatibility/d /Variation Selector/d - s/[^;]*/\\\\u&/ + s/[^;]*/\\u&/ ' >"$DATA" } readonly DATA="${XDG_DATA_HOME:-$HOME/.local/share}/unicode-data" [ -f "$DATA" ] || setup -opt="$(cut -d';' -f2 "$DATA" | osel)" -rune="$(awk -vopt="$opt" -F';' '$2 == opt { print $1 }' "$DATA" | xargs printf)" +idx="$(cut -d';' -f2 "$DATA" | osel -i)" +code="$(head -n "$idx" "$DATA" | tail -n1 | cut -d';' -f1)" +rune="$(printf $code)" if [ -t 2 ] then |