Hi, chip!
Nice summary.
This is my solution with awk for generating xml-file from text file with space as field separator:
# to_xml.awk - save data in xml format
# to_xml.awk - croatian: pohrana podataka u xml-zapis
# Kruno Peter, kruno_peter@yahoo.com
# awk, Public Domain, Mar. 2001.
# Jesus loves you.
BEGIN { print "<?xml version=\"1.0\"?>" }
NR == 1 { print "<file filename=\"" FILENAME "\">" }
{
print "<record>"
for (i = 1; i <= NF; i ++)
print " <fld" i ">" $i "<\/fld" i ">"
print "<\/record>"
}
END { print "<\/file>" }
This awk-source can be placed in a file to_xml.awk and executed by the command:
awk -f to_xml.awk inputfile
For example, if input file with name somedata.txt is
like this:
Krunek awk
Sinisa python
Output will be:
<?xml version="1.0"?>
<file filename="somedata.txt">
<record>
<fld1>Krunek</fld1>
<fld2>awk</fld2>
</record>
<record>
<fld1>Sinisa</fld1>
<fld2>python</fld2>
</record>
</file>
awk is standard unix scripting programming language.
free awk-interpreter (for DOS, Win, Linux) can be found on this site:
(GNU, thanks!).
I hope this helps.
Bye!
KP.