#!/bin/sh
# Find unicode characters by grepping for matching descriptions or hex codes.
# All credit goes to Perl for providing Name.pl, a table of Unicode character
# codes and descriptions
# Example usage:
# $ unicode delta
#
# ƍ 0018D LATIN SMALL LETTER TURNED DELTA
# Δ 00394 GREEK CAPITAL LETTER DELTA
# δ 003B4 GREEK SMALL LETTER DELTA
# ᵟ 01D5F MODIFIER LETTER SMALL DELTA
# ẟ 01E9F LATIN SMALL LETTER DELTA
# ≜ 0225C DELTA EQUAL TO
# ⍋ 0234B APL FUNCTIONAL SYMBOL DELTA STILE
# [...]
grep -i "$@" "$(locate Name.pl | head -1)" |
python3 -c '
import sys
for line in sys.stdin:
code, desc = line.split(None, 1)
try:
char = chr(int(code, 16))
print(char, line, end="")
except ValueError:
print(line, end="")
'