[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: command or script for converting hex values to text



ankush grover wrote:
...
> Important is accepting the file as input and converting all the values
> in it to text values
> 
> 41 65 72 74 3A 20 49 6E 74 65 72 66 61 63 65
> 
> the output of the above should be "APRIL FOOL".

If you file contains a mixture of hex and plain
text, a perl one-liner could do the trick:

$ perl -pe 's/[0-9A-Fa-f][0-9A-Fa-f]\s+/chr(hex($&))/ge' input.dat
Aert: Interface

You might have to change the whitespace part of the RE.

Mogens

-- 
Mogens Kjaer, Carlsberg A/S, Computer Department
Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark
Phone: +45 33 27 53 25, Fax: +45 33 27 47 08
Email: mk crc dk Homepage: http://www.crc.dk


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]