[ILUG] converting strings of hex to ascii

Padraig Brady padraig.brady at corvil.com
Mon Aug 26 12:07:30 IST 2002


Paul Jakma wrote:
> can anyone think of an easy way to convert strings that describe 
> ASCII chars in hex to plain ASCII?
> 
> eg given 
> 
> 	http://w%77%77%2Eo%70%74%6F%72%69um.n%65t/remove.html
> 
> is there an easy way to turn it into
> 
> 	http://www.optorium.net/remove.html
> 
> ?
> 
> eg, whether by piping through some already available tool, or 
> programmatically (printf? - but i dont see how.).
> 
> want to avoid ascii lookup tables..
> 
> regards,

[padraig at pixelbeat padraig]$ 
enc="http://w%77%77%2Eo%70%74%6F%72%69um.n%65t/remove.html"
[padraig at pixelbeat padraig]$ echo -e "`echo "$enc" | sed 's/%\([0-9]*\)/\\\x\1/g'`"





More information about the ILUG mailing list