In addition to the standard format specifications described in printf(1),
printf interprets:
%b expand backslash escape sequences in the corresponding argument
And:
$ printf "%b\n" '\101'
A
I don't know if it works for Unicode characters in general.
The %b operator isn't necessary (as long as your octals aren't \0NNN form, at least in the macOS 11.5 bash3 built-in, the macOS BSD-UNIX printf, and also gnu-printf 8.32.
This character is U+B000 (n=45,056). The decomposed one is more verbose but works the same
Presumably you want
%b
. Fromhelp printf
:And:
I don't know if it works for Unicode characters in general.
You can use Awk:
Or the awk Velour library:
It works with unicode as long as you type out the byte.
The
%b
operator isn't necessary (as long as your octals aren't\0NNN
form, at least in the macOS 11.5 bash3 built-in, the macOS BSD-UNIXprintf
, and alsognu-printf 8.32
.This character is
U+B000
(n=45,056). The decomposed one is more verbose but works the same