EvanCarroll has asked for the wisdom of the Perl Monks concerning the following question:
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...
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hexdump/od/perl question
by oxone (Friar) on Aug 10, 2007 at 18:05 UTC | |
by ikegami (Patriarch) on Aug 10, 2007 at 18:07 UTC | |
by EvanCarroll (Chaplain) on Aug 10, 2007 at 18:14 UTC | |
by jbert (Priest) on Aug 10, 2007 at 18:39 UTC | |
by aufflick (Deacon) on Aug 12, 2007 at 11:57 UTC | |
by ikegami (Patriarch) on Aug 10, 2007 at 18:16 UTC | |
by graff (Chancellor) on Aug 11, 2007 at 15:42 UTC | |
by EvanCarroll (Chaplain) on Aug 12, 2007 at 05:25 UTC | |
|
Re: hexdump/od/perl question
by ikegami (Patriarch) on Aug 10, 2007 at 17:22 UTC | |
by EvanCarroll (Chaplain) on Aug 10, 2007 at 17:33 UTC | |
by ikegami (Patriarch) on Aug 10, 2007 at 17:37 UTC | |
by EvanCarroll (Chaplain) on Aug 10, 2007 at 17:52 UTC | |
by ikegami (Patriarch) on Aug 10, 2007 at 18:00 UTC | |
|