in reply to convert several two digit hex characters to ascii
use strict; use warnings; while (<DATA>) { if (/0x([[:xdigit:]]+)/) { my $hexstr = $1; my $word; while ($hexstr =~ /(..)/g) {$word .= chr hex $1} s/0x$hexstr/$word/; } print; } __DATA__ blah0x4445434C41524520405420blah blah foo zoo 75858
prints out:
blahDECLARE @T lah blah foo zoo 75858
You'll need to figure out how to deal with the 2nd "blah", whose 1st letter is a valid hex digit.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: convert several two digit hex characters to ascii
by ikegami (Patriarch) on Dec 01, 2008 at 22:33 UTC |