Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: PERL UNIX and strangeness and char conversion

by tybalt89 (Monsignor)
on Jan 18, 2021 at 19:54 UTC ( [id://11127070]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11127070]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-04-23 10:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found