FILE-1
USER username@foo.com
TOOLIN tool-a
TOOL2 tool-b
TOOL3 tool-c
TOOL4 tool-d
TOOL5 tool-e
USER username_2@foo.com
TOOLIN tool-e
TOOL2 tool-f
TOOL3 tool-c
TOOL4 tool-d
....
I need to take this file and generate a target XML file -
<access>
<managed>
<!-- Admin Servlet names listed here have access controls enforced -->
<tool>tool-a</tool>
<tool>tool-b</tool>
<tool>tool-c</tool>
<tool>tool-d</tool>
<tool>tool-e</tool>
<tool>tool-f</tool>
</managed>
<users>
<user name="username@foo.com">
<tools>
<tool>tool-a</tool>
<tool>tool-b</tool>
<tool>tool-c</tool>
<tool>tool-d</tool>
<tool>tool-e</tool>
</tools>
</user>
<user name="username_2@foo.com">
<tools>
<tool>tool-e</tool>
<tool>tool-f</tool>
<tool>tool-c</tool>
<tool>tool-d</tool>
</tools>
</user>
</users>
</access>
Since I am new to scripting please suggest a script which can do that...
Thanks,
Jack