Padraig Brady wrote:
> 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'`"
Actually the following would be in some way sensible:
echo -e "`echo "$enc" | sed 's/%\([0-9a-fA-F]\{2,2\}\)/\\\x\1/g'`"
Padraig.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!