Page 1 of 1

sed command: effect to the letter

Posted: Sun Dec 06, 2020 7:27 pm
by arivas_2005

I found these two lines (internet -gtk-dialogs info.)

Code: Select all

  echo "subrayando" | sed "s/./&\xCD\x9F/g" >>/text # 
  echo "tachando" | sed "s/./&\xCC\xB6/g" >> /text #   

that modify the letter effect and I ask if there are more effects like these and if it can also be colored using the same model
For example, make the letter a appear indentation of the background ░ or – or — or | (overwritten)
or put blue color ..
I have that great curiosity that has generated those two lines of sed
Thank you


Re: sed command: effect to the letter

Posted: Mon Dec 07, 2020 2:42 am
by MochiMoppel
arivas_2005 wrote: Sun Dec 06, 2020 7:27 pm

I ask if there are more effects like these

There are quite a few, but I found that underline and strikethrough, as in your example, work best. Maybe also

Code: Select all

echo 'Sample text with solidus overlay' | sed 's/./&\xcc\xb8/g' # S̸a̸m̸p̸l̸e̸ ̸t̸e̸x̸t̸ ̸w̸i̸t̸h̸ ̸s̸o̸l̸i̸d̸u̸s̸ ̸o̸v̸e̸r̸l̸a̸y̸

All other effects work best with single characters, e.g. you can put a double line over each character, but since characters can have different heights this will not result in a straight line.

and if it can also be colored using the same model

No. Of course you can use sed to add escape characters which add color to terminal output or you can add pango markup for gtkdialog text, but changing colors with an added Unicode character is not possible.

For example, make the letter a appear indentation of the background ░ or – or — or | (overwritten)

Also not possible. You can not overwrite a letter with another letter.


Re: sed command: effect to the letter

Posted: Mon Dec 07, 2020 3:10 am
by arivas_2005

Thanks!
And is there any URL or documentation where you can find the combinations, like these?
\xCD\x9F
\xCC\xB6
\xcc\xb8


Re: sed command: effect to the letter

Posted: Mon Dec 07, 2020 7:53 pm
by puppy_apprentice

As MM wrote those are Unicode characters. Check this:
https://www.utf8-chartable.de/unicode-u ... ng-literal


Re: sed command: effect to the letter

Posted: Mon Oct 04, 2021 2:34 am
by MochiMoppel

Old thread, new discoveries.

By using Unicode it is possible to convert plain ASCII text into styled text, e.g. bold and/or italic.
It would (mis)use characters of Unicode block "Mathematical Alphanumeric Symbols" (the Unicode consortium expressly discourages the use for anything else but mathematical formulas).

This should work in most Puppies:

Code: Select all

Xdialog -msg "$(printf 'This text is \xf0\x9d\x97\xaf\xf0\x9d\x97\xbc\xf0\x9d\x97\xb9\xf0\x9d\x97\xb1!)" x
Screenshot.png
Screenshot.png (3.02 KiB) Viewed 873 times

@rockedge Is the search function broken? I tried to find this thread with keywords Unicode and strikethrough , all of which appear in the text. 0 results. I also searched for my oldest thread which contains the word pxRuler. Also no result.


Re: sed command: effect to the letter

Posted: Mon Oct 04, 2021 3:26 am
by rockedge

@MochiMoppel Thanks for the tip. I tested it and it did not find the post though the search index is intact.

Here is the post -> viewtopic.php?p=548#p548


Re: sed command: effect to the letter

Posted: Thu Oct 07, 2021 7:39 am
by MochiMoppel

Ooops, the topic is "sed command". Then let's use sed. Very convenient for dynamic on-the-fly ASCII to UTF-8 conversion:

Code: Select all

#!/bin/sh
while : ; do
	echo XXX
	date +'Current time is:%T' | sed y/0123456789/𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵/
	sleep 1
	echo XXX
done | Xdialog -info '' 220x80 0
Screenshot.png
Screenshot.png (4.64 KiB) Viewed 824 times