[Update! Thanks to a tip from ioggstream, I've fixed both of the bugs mentioned below.]
You, yes, 𝙔𝙊𝙐, can be the terror of the Internet! Why use normal, boring bullet points in your text, when you could use a ROTATED HEAVY BLACK HEART BULLET (❥)!? (Which would also be an awesome band name, by the way).
This script makes it easy to find unusual characters from the command line. You can then cut and paste them or, if you're using a GTK application, type Control+Shift+U followed by the code point number (e.g., 2765) and then a SPACE.
USAGE: Put this script in a file (I called mine "ugrep") and make it executable. Run it from the command line like so,
ugrep heart
The output will look like this,
☙ U+2619 REVERSED ROTATED FLORAL HEART BULLET
♡ U+2661 WHITE HEART SUIT
♥ U+2665 BLACK HEART SUIT
❣ U+2763 HEAVY HEART EXCLAMATION MARK ORNAMENT
❤ U+2764 HEAVY BLACK HEART
❥ U+2765 ROTATED HEAVY BLACK HEART BULLET
❦ U+2766 FLORAL HEART
❧ U+2767 ROTATED FLORAL HEART BULLET
⺖ U+2E96 CJK RADICAL HEART ONE
⺗ U+2E97 CJK RADICAL HEART TWO
⼼ U+2F3C KANGXI RADICAL HEART
You can, of course, use regular expressions. For example, if you are looking for the "pi" symbol, you could do this:
ugrep '\bpi\b'
REQUIREMENTS: Although this is written in Bash, it assumes you have Perl installed because it greps through the Perl Unicode character name module (/usr/lib/perl5/Unicode/CharName.pm). Note that it would not have made more sense to write this in Perl, since the CharName.pm module doesn't actually include a subroutine for looking up a character based on the description. (Weird.)
BUGS: In order to fit this script in the commandlinefu limits, a couple bugs were added. ① Astral characters beyond the BMP (basic multilingual plane) are not displayed correctly, but see below. ② Perl code from the perl module being grepped is sometimes extraneously matched.
MISFEATURES: Bash's printf cannot, given a Unicode codepoint, print the resulting character to the terminal. GNU's coreutils printf (usually "/usr/bin/printf") can do so, but it is brokenly pedantic about how many hexadecimal digits follow the escape sequence and will actually die with an error if you give the wrong number. This is especially annoying since Unicode code points are usually variable length with implied leading zeros. The CharNames.pm file represents BMP characters as 4 hexits, but astral characters as 5. In the actual version of this script that I use, I've kludged around this misfeature by zero-padding to 8 hexits like so,
/usr/bin/printf "\U$(printf "%08x" 0x$hex)"
TIP 1: The author recommends "xsel" for command line cut-and-paste. For example,
ugrep biohazard | xsel
TIP 2: In Emacs, instead of running this command in a subshell, you can type Unicode code points directly by pressing Control-Q first, but you'll likely want to change the default input from octal to hexadecimal. (setq read-quoted-char-radix 16).
TIP 3: Of course, if you're using X, and you want to type one of the more common unusual characters, it's easiest of all to do it with your Compose (aka Multi) key. For example, hitting [Compose] <3 types ♥.
Show Sample Output
Generates a TV noise alike output in the terminal. Can be combined with https://www.commandlinefu.com/commands/view/9728/make-some-powerful-pink-noise
No need for further filedes or substitution for splitting. Simply use read a b
Converts control codes and spaces (ASCII code ≤ 32) to visible Unicode Control Pictures, U+2400 ? U+2420. Skips \n characters, which is probably a good thing. Show Sample Output
If you tried the other Python version of Convert JSON to YAML and you end up with lines that has "!!python/unicode", this version of the command is for you.
This is especially useful to get crazy stuff like space characters copied to your pasteboard correctly. Source: https://github.com/mathiasbynens/dotfiles/blob/master/.functions Show Sample Output
Not better, but more lightweight (sed instead of perl).
Above command is reduced due to length restriction of less than 256 characters and entity encoding of "Save" command on this page. This is complete command (best without entity encoding):
echo -e '\x2Helo folks\t!\r' | sed "y/\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xA\xB\xC\xD\xE\xF\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20/␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟␠/"
␂Helo␠folks␉!␍
Show Sample Output
Prints a string as a sequence of hexadecimal values. Output comes in space separated pairs, regardless of ASCII or Unicode characters Show Sample Output
Get 'ack' now at http://betterthangrep.com/
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: