Convert Text file to XML file -
i want parse teh content of text file in below format
example of text file data
key1:value1 key2:value2 key3:value3
now want above content parsed key-value format , make xml file text file.
example of xml file data (i want type of format)
<string name="key1">value1</string> <string name="key2">vaue2</string> <string name="key3">value3</string>
this should either done thorough script file in windows or command prompt.
could please ant 1 have better idea how solve on issue or please provide me example code or link of tutorials?
problem trivial using program called awk
$ awk -f: 'begin{print"<data>"} {printf"<string name=\"%s\">%s</string>\n",$1,$2} end{print"</data>"}' input.txt <data> <string name="key1">value1</string> <string name="key2">value2</string> <string name="key3">value3</string> </data>
Comments
Post a Comment