|
Answer» Hi,
Can anyone help me to do this. Thanks.
Traxcopy *.xml *.csv
This will copy all XML files as CSV's and leave a copy of the XML still present.
Cant be that simple right? You probably need to delimit your data, change its structure from the normal xml data structure?Dave,
That will only do straight copy from *.xml to *.csv, in this case i am required to save it as xml list format.
Trax Can you POST a sample or copy of the xml file so i can see its structure?say from this;
--> - - - -
to;
id value value2 value3 value4 value5 value6 RET_TRIAL 1 RET_TRIAL 1 RET_TRIAL 1 RET_TRIAL 1 RET_TRIAL 0 RET_TRIAL 1 RET_TRIAL_HS 1 RET_TRIAL_HS 3 RET_TRIAL_HS 1 RET_TRIAL_HS 1 RET_TRIAL_HS 0 RET_TRIAL_HS 1 if you have gawk for windows (see my sig)
Code: [Select]/<\/Mapping>/{f=0} /<Mapping id/{ gsub(/.*Mapping id=\"|\".*/,"") title=$0 f=1 } f && /value/{ gsub(/.*value=\"|\".*/,"") val=$0 print title" "val }
save the above as myscript.awk and on command LINE
Code: [Select]C:\test>gawk -f test.awk file.txt RET_TRIAL 1 RET_TRIAL 1 RET_TRIAL 1 RET_TRIAL 1 RET_TRIAL 0 RET_TRIAL 1 RET_TRIAL_HS 1 RET_TRIAL_HS 3 RET_TRIAL_HS 1 RET_TRIAL_HS 1 RET_TRIAL_HS 0 RET_TRIAL_HS 1 RET_TRIAL_ENT 1 RET_TRIAL_ENT 1 RET_TRIAL_ENT 1 RET_TRIAL_ENT 1 RET_TRIAL_ENT 1 RET_TRIAL_ENT 0
i don't really understand your output sample. (you should PUT them in code tags), so this is as far as i can go.Please see files attached. I simply open testfrom.xml with excel and save as testto.csv (need to change the ext to attach). Thanks.
[attachment deleted by admin]and then the sample you gave is TOTALLY DIFFERENT from the attached csv. why don't you describe properly what you want to get. I (or we) am not going to guess for you.sorry for that. i actually have few files to convert and those are the 2. not trying to make you to guess, the first sample just too big to attached.
|