0

I have a 'typescript' file that if i cat -v I get the following within the output:

M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-

These seem to be rendered within the terminal while running the 'typescript'. How can I transform these to an appropriate plain text representation?

Running sed "s/M-bM-^TM-^@/testing123/g" on this file does not seem to work.

Here is the whole file:

cat -v typescript
Script started on 2018-07-07 19:08:54+00:00
^[[?1049h^[[22;0;0t^[[H^[[2J^[[?25l^[[1;1H^[(B^[[mHello,                                                                                                                              ^[[2;1H^[(B^[[mWorld!                                                                                                                              ^[[3;1H^[(B^[[mM-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-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TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@M-bM-^TM-^@^[[4;1H^[(B^[[m                                                                                                                                    ^[[5;1H^[(B^[[m                                                                                                                                    ^[[6;1H^[(B^[[m                                                                                                                                    ^[[7;1H^[(B^[[m                                                                                                                                    ^[[8;1H^[(B^[[m                                                                                                                                    ^[[9;1H^[(B^[[m                                                                                                                                    ^[[10;1H^[(B^[[m                                                                                                                                    ^[[11;1H^[(B^[[m                                                                                                                                    ^[[12;1H^[(B^[[m                                                                                                                                    ^[[13;1H^[(B^[[m                                                                                                                                    ^[[14;1H^[(B^[[m                                                                                                                                    ^[[15;1H^[(B^[[m                                                                                                                                    ^[[16;1H^[(B^[[m                                                                                                                                    ^[[17;1H^[(B^[[m                                                                                                                                    ^[[18;1H^[(B^[[m                                                                                                                                    ^[[19;1H^[(B^[[m                                                                                                                                    ^[[20;1H^[(B^[[m                                                                                                                                    ^[[21;1H^[(B^[[m                                                                                                                                    ^[[22;1H^[(B^[[m                                                                                                                                    ^[[23;1H^[(B^[[m                                                                                                                                    ^[[24;1H^[(B^[[m                                                                                                                                    ^[[25;1H^[(B^[[m                                                                                                                                    ^[[26;1H^[(B^[[m                                                                                                                                    ^[[27;1H^[(B^[[m                                                                                                                                    ^[[28;1H^[(B^[[m                                                                                                                                    ^[[29;1H^[(B^[[m                                                                                                                                    ^[[30;1H^[(B^[[m                                                                                                                                    ^[[31;1H^[(B^[[m                                                                                                                                    ^[[32;1H^[(B^[[m                                                                                                                                    ^[[33;1H^[(B^[[m                                                                                                                                    ^[[34;1H^[(B^[[m                                                                                                                                    ^[[?1049l^[[23;0;0t^[[?12l^[[?25h^[(B^[[m^[[?12l^[[?25h5^M
zsh:1: command not found: k^M

Script done on 2018-07-07 19:08:55+00:00

closed as unclear what you're asking by Rui F Ribeiro, Thomas Dickey, G-Man, Romeo Ninov, schily Jul 8 '18 at 9:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Please give a bit more context. Which application produces this sequence? Where do you see them? In which kind of program they are rendered as -? A terminal emulator? Which one? – dirkt Jul 7 '18 at 17:48
  • It's from a typescript file. I'm trying to 'hack' the file to display as plain text in a web browser. – Chris Stryczynski Jul 7 '18 at 18:38
  • col may possibly help? – Kusalananda Jul 7 '18 at 21:04
  • 1
    M- is often used to represent meta characters (codes 160-255), and ^T, ^@ are usually representing control/T, and null. But without some clue of the application and context, there's nothing to go on. – Thomas Dickey Jul 7 '18 at 21:36
3

Assuming that M- is meta and ^ is control, the sequence M-b M-^T M-^@ represents hex e4 94 80. The character you gave is unicode U2500, "BOX DRAWINGS LIGHT HORIZONTAL". If you line up the bit patterns, you get something like

1110 0100  1001 0100  1000 0000 = e4 94 80
   0 0100     1 0100    00 0000 = 2500

So this seems to be a multibyte encoding, where the MSBs denote "first byte" and "following byte", but it's not entirely clear how. (Or this guess is wrong, and in reality the encoding is different). This is not UTF-8, and I have no idea what it is.

I'm also not sure if this answers your question, because you already know that this sequence is rendered as a single character, and which character that is. And in the same way you know that, you'd be able to find out other characters.

So without any more information this probably has no real answer.

  • Thanks your answer led me to sed "s/$(echo -ne '\u2500')/testing123/g" which seems to do the job. – Chris Stryczynski Jul 8 '18 at 9:40
  • 1
    Close. M-b is e2 not e4, and e2 94 80 is indeed UTF8 for 2500. – dave_thompson_085 Jul 8 '18 at 14:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.