Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
490 B

  1. #!/usr/bin/perl -CAO
  2. # via @chneukirchen
  3. # uni PATTERN - list unicode symbols matching PATTERN
  4. BEGIN { $SIG{'__WARN__'} = sub { } }; # silence next load
  5. use Unicode::CharName;
  6. my $rx = shift || die "Usage: uni PATTERN\n";
  7. m/$rx/; # fail early on faulty regexps
  8. while (<Unicode::CharName::DATA>) {
  9. my ($hex, $desc) = split(/ /, $_, 2);
  10. $char = pack("U", hex($hex));
  11. if ($desc =~ /$rx/i || $char eq $rx || lc($hex) eq lc($rx)) {
  12. print "$char\t$hex\t$desc";
  13. }
  14. }