http://qs321.pair.com?node_id=11127070


in reply to PERL UNIX and strangeness and char conversion

""more" and those editors are all correct. They are just showing a different representation of the same unprintable character.

perl -pe 'tr/\x80-\xff/?/' <oldfile >convertedfile

There. I've converted all that strangeness to a plain ASCII ? just like you asked.

Replies are listed 'Best First'.
Re^2: PERL UNIX and strangeness and char conversion
by Anonymous Monk on Jan 18, 2021 at 21:55 UTC

    OK! I THINK I GET IT

    perl -pe 'tr/\x93-\x94/"/' <INFILE >OUTFILE
    Inserts the "
    perl -pe 'tr/\x97/,/' <INFILE >OUTFILE
    Inserts the ,
    perl -pe 'tr/\x91-\x92/'/' <INFILE >OUTFILE
    Croaks.

    If I insert "\" to escape the second ' IT STILL CROAKS!
    What is special about \x91 and \x92 in the above statement?
    At least I made progress this time...

      The bash shell does not take escapes, try

      perl -pe 'tr/\x91-\x92/\x27/' <INFILE >OUTFILE
      instead.