Using awk printf to urldecode text

后端 未结 5 1555
一向
一向 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 03:53

    GNU awk

    #!/usr/bin/awk -fn
    @include "ord"
    BEGIN {
      RS = "%.."
    }
    {
      printf RT ? $0 chr("0x" substr(RT, 2)) : $0
    }
    

    Or

    #!/bin/sh
    awk -niord '{printf RT?$0chr("0x"substr(RT,2)):$0}' RS=%..
    

    Decoding URL encoding (percent encoding)

提交回复
热议问题