Splitting URL request string including escape characters

Hi All,
I have a text file containing two fields, the first field holds the website name and the second one holds the rest of the URL (Request part). My requirement is to split the request part based on the characters "=" and "&". The process should also consider the URL escape characters, for example if the URL contains any of the escape code listed below it should be replaced with the corresponding character. A sample is shown below:

========================================================
INPUT (Data in the text file, can contain 1 million rows)
=========================================================
www.testwebsite.com;I_CMDTypeOrig=&I_OrderReceiptTime=10%3A35%3A10&verifySO=Y&I_Acc=ABC373&loadEvaluated=false&I_OrderReceiptDate=09%2F02%2F2009&I_SecId=JED&
 
========================================================
OUTPUT
Note in the below output %3A has been replaced by ":" and %2F with "/"
========================================================
WEBISTENAME;KEY;VALUE
www.testwebsite.com; I_CMDTypeOrig;NULL
www.testwebsite.com; I_OrderReceiptTime;10:35:10
www.testwebsite.com; verifySO;Y
www.testwebsite.com; I_Acc ;ABC373
www.testwebsite.com; loadEvaluated;false
www.testwebsite.com; I_OrderReceiptDate;09/02/2009
www.testwebsite.com; I_SecId;JED
========================================================
URL Escape Characters
========================================================
Character    Escape Code
SPACE => %20
[ => %5B
< => %3C
] => %5D
> => %3E
` => %60
# => %23
;  => %3B
% => %25
/  => %2F
{  => %7B
?  => %3F
}  => %7D
:  => %3A
|  => %7C
@ => %40
\  => %5C
=  => %3D
^ => %5E
&  => %26
~ => %7E
$  => %24
========================================================

Any pointers to arrive at the above output will be greatly appreciated.

Thanks in advance.
~John

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

One pointer for the first part:

awk 'BEGIN{FS="[;=&]";OFS=";"}{for (i=2;i<=NF;i+=($(i+1)?1:2)) print $1,$i,$(i+1)?$(i+1):"NULL"}'  input.file

For the replacement part, either you work with the awk string functions like sub(), gsub() or gensub() or first process your input file with sed that I think will be more efficient in string replacement.

[quote=ripat;302350395]
One pointer for the first part:

Thanks for the quick repsonse Ripat. I will work based on your suggestion.

To urldecode in awk, I found this:
unix