Replace percent-escaped characters in string ( , [, …) with bash

前端 未结 2 1084
无人及你
无人及你 2021-02-09 14:11

I have strings containing percent-escaped characters like %20 and %5B, and I would like to transform it to \"normal\" characters like \\ f

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-09 14:45

    Finally, thanks to #bash IRC channel, I found a "not so bad" solution :

    echo `echo string%20with%5Bsome%23 | sed 's/%/\\\x/g'`
    

提交回复
热议问题