Dear monks teach me something.. I'm having this issue a lot lately. I either scrape a website, or a pull in data from a csv, and I get stupid garbled non-sense like this:

SERIAL# �-----------------. WD2PD644366123

I know what to do insomuch as this involves using `od` but when it comes to ridding the characters in perl, I always get lost, and up figuring it out with an almost brute force approach.

So `od -c` will output

0104200 D 5 3 0 0 6 \n S T O C K N +O 0104220 375 - - - - - - - - . . . . . . +.

so the character I want remove has a od code of 0375 -- obviously that isn't right..

`od -xc` will return this

2dfd 375

not sure what this means

`hexdump -c` returns

0008880 D 5 0008890 375 - -

so 375 is obviously significant in `od -c` (oct) or `hexdump -c` (hex) ... Could someone please explain or point me to where I can find out how to use these utilities effectively, and how I strip them from text, I thought a simple tr/\{something here}//d would work...

Problem found

See Re^2: hexdump/od/perl question which is on this thread. Note to readers you don't always address octals with a leading 0



Evan Carroll
www.EvanCarroll.com

In reply to hexdump/od/perl question by EvanCarroll

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.