Using awk printf to urldecode text

后端 未结 5 1530
一向
一向 2021-01-05 03:23

I\'m using awk to urldecode some text.

If I code the string into the printf statement like printf \"%s\", \"\\x3D\" it correct

5条回答
  •  臣服心动
    2021-01-05 04:09

    I don't know how you do this in awk, but it's trivial in perl:

    echo "http://example.com/?q=foo%3Dbar" | 
        perl -pe 's/\+/ /g; s/%([0-9a-f]{2})/chr(hex($1))/eig'
    

提交回复
热议问题