0

I am having problems using unix tools that I usually use because I cannot use some characters in QSHell. For example, in linux, I can replace specific bytes on a file like this:

sed 's/l/\x81/' a.txt

In that case, I am replacing 'l' by the byte x81. However, in Qshell, I cannot use \x , for example,

printf '\x81'
Öx81   

As we see, \x81 does not print as an 'a', which is the \x81 in EBCDIC, the encoding from iSeries. It doesn't even try to print a byte, it is printing a string of length 4...

What I am trying to do is simply using sed to replace the carriage return, by carriage return and new line and things like that. I realized that the character \ is not present in EBCDIC, as neither are {}. So, there are also some unix commands that use those characters that show an error in QShell. Please help, I cannot find a way to make things work online, so I am failing to write any script.

To make the question not ambiguous, I specifically need a way to printf a character using its hex representation in Qshell.

I am using PCOMM tn5250 to connect to the AS/400.

mswatosh
  • 466
  • 2
  • 8
Sfp
  • 539
  • 4
  • 15

1 Answers1

0

You need to escape the escape like this:

printf \\x81

a

F Rowe
  • 2,042
  • 1
  • 11
  • 12
  • I have tried that and it doesnt work, printf "\\x81" ÖÖx81$ Did you configure something on the tn5250 or change the encoding of qshell or anything like that? thanks – Sfp Sep 16 '20 at 20:14
  • I used ssh to access the system and then started qsh. You may need to config the code page of the terminal emulator. – F Rowe Sep 16 '20 at 20:59