According to this answer I wrote a small script to get the decoded output of a text file that has some url encoded strings.
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
input="temp.txt"
while IFS= read -r line
do
eval urldecode "$line"
done < "$input"
The problem I found was that while the string foo%20bar
was decoded as foo bar
, http%3A%2F%2F
was not decoded. Both of them appear in several lines.
I tried executing single file lines from Terminal and all went good.