How can I add spaces between every character or symbol within a UTF-8 document? E.g. 123hello!
becomes 1 2 3 h e l l o !
.
BASH
, OpenOffice.org
, and gedit
, if any of those can do that.Kerning refers to the amount of space between two letters (or other characters: Numbers, punctuation, etc.) and the process of adjusting that space to avoid awkward-looking gaps between your letters and improve legibility. In this article, we will outline how to kern like a professional designer.
In C language, we can directly add spaces. printf(“ ”); This gives a space on the output screen.
Shortest sed
version
sed 's/./& /g'
$ echo '123hello!' | sed 's/./& /g'
1 2 3 h e l l o !
Obligatory awk
version
awk '$1=$1' FS= OFS=" "
$ echo '123hello!' | awk '$1=$1' FS= OFS=" "
1 2 3 h e l l o !
sed(1)
can do this:
$ sed -e 's/\(.\)/\1 /g' < /etc/passwd
r o o t : x : 0 : 0 : r o o t : / r o o t : / b i n / b a s h
d a e m o n : x : 1 : 1 : d a e m o n : / u s r / s b i n : / b i n / s h
It works well on e.g. UTF-8 encoded Japanese content:
$ file japanese
japanese: UTF-8 Unicode text
$ sed -e 's/\(.\)/\1 /g' < japanese
E X I F 中 の 画 像 回 転 情 報 対 応 に よ り 、 一 部 画 像 ( 特 に 『
$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With