wrote:
> Is there a program out there that can take a quasi-XML file and make it
> user-friendly and easy to read? By quasi-XML I mean a plain text file
> that is in the format below.
Use an AWK script. The following script works, I tested it.
BEGIN {
n=1
filename = "quasi_xml_dat_" n ".xml"
}
{
if (/^[0-9]*:/) {
if (n>0)
close(filename)
filename = "quasi_xml_dat_" ++n ".xml"
} else {
print $0 >> filename
}
}
The result you get is something like this:
> ls -l *xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_10.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_11.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_12.xml
-rw-r--r-- 1 kahrs users 235 2006-11-11 19:52 quasi_xml_dat_13.xml
-rw-r--r-- 1 kahrs users 226 2006-11-11 19:52 quasi_xml_dat_14.xml
-rw-r--r-- 1 kahrs users 249 2006-11-11 19:52 quasi_xml_dat_15.xml
-rw-r--r-- 1 kahrs users 213 2006-11-11 19:52 quasi_xml_dat_16.xml
-rw-r--r-- 1 kahrs users 1 2006-11-11 19:52 quasi_xml_dat_2.xml
-rw-r--r-- 1 kahrs users 254 2006-11-11 19:52 quasi_xml_dat_3.xml
-rw-r--r-- 1 kahrs users 792 2006-11-11 19:52 quasi_xml_dat_4.xml
-rw-r--r-- 1 kahrs users 222 2006-11-11 19:52 quasi_xml_dat_5.xml
-rw-r--r-- 1 kahrs users 248 2006-11-11 19:52 quasi_xml_dat_6.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_7.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_8.xml
-rw-r--r-- 1 kahrs users 268 2006-11-11 19:52 quasi_xml_dat_9.xml
> cat quasi_xml_dat_10.xml
<?xml version="1.0" encoding="UTF-8"?>
<CommandList Id="1"><Command Id="7"
TS="128031691709539137"><Destination ContentId="300016768"
GroupId="1"/><Action Type="Get" Scope="Children"><Filter><Condition
Type="Presentation4"/></Filter></Action></Command></CommandList>
> I know the time stamps messes up the format a bit. And these logs have
> hundreds, thousands of lines. You can see why I'm looking for something
> that can help me read them.
Yes, the time stamps mess up the format.
The script will work for millions of lines.
Notice that the script is only about 80% of a
complete solution because some of your quasi-XML
section have no XML declaration header.