reformatting xml file, sed or awk I think (possibly perl)
I have some xml files that cannot be read using a standard parser, or I am using the wrong parser. The issues seems to be spaces in some of the tags.
Here is a sample,
The parser isn't able to find the number 2, so that information is lost, etc. It seems as if it would like,
I seems like it would be pretty simple to script up something to convert between these two formats.
I believe that you can also do,
Which would be much easier to manage in sed, since it only involves one line.
I don't know much of anything about xml, so suggestions would be appreciated.
I don't seem to have re-installed perl the last time I re-installed cygwin, so I didn't get to try that suggestion.
I have a few other things that need to be converted to proper metadata arguments.
It seemed like the following should work,
The first line works for <Fmt TEXT> and <Lay Input> and gives the expected, <Fmt Fmt ="TEXT"> and <Lay Lay="Input">, but does not recognize <Name Net_0>, I expect because of the underscore. The <text number> command doesn't work at all, though it seems properly formed.
Perhaps I need a newer dictionary???
LMHmedchem
---------- Post updated 04-16-11 at 05:13 PM ---------- Previous update was 04-15-11 at 05:23 PM ----------
I have found a few things that I think I need to do in awk or perl.
I have this,
This is of the format <Cn Cn="int"> where subsequent lines have an int and float as int | space | float. I need to change the int into tags with the float as the data member of the tag.
There is also this, which seems easier,
where there is a <Un> tag with a float on the next line. All that is needed here is to insert the float into a tag,
I tried a few things like,
's/<\(<Un>/n)\ \([1-9]*\)/<\1\ <Bias>\2</Bias>/g'
but I obviously don't have that quite right.
LMHmedchem
Last edited by LMHmedchem; 04-15-2011 at 06:49 PM..
Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file:
</member>
<member>
<name>TransactionID</name>
<value><string>123456789123456</string></value>
</member>
<member>
<name>Number</name>
... (9 Replies)
Hi Everyone,
I'm new here and I was checking this old post:
/shell-programming-and-scripting/180669-splitting-file-into-several-smaller-files-using-perl.html
(cannot paste link because of lack of points)
I need to do something like this but understand very little of perl.
I also check... (4 Replies)
Hello,
I have a requirement to extract the value from multiple xml node and print out the values to new file to compare.
Would be done using either awk/perl or some unix script.
For example sample input file:
.....
.....
<factories xmi:type="resources.jdbc:DataSource"... (2 Replies)
Hi All,
I need help from any of you.Would be so thankful for your help.
I/P
DDDD,1045,161,1557,429,1694,800,1911,1113,2460,1457,2917>
1609,3113,1869,3317,2732,3701,3727,4132,5857,5107>
9004,6496
DDDD,1125,157,1558,429,1694,800,1911,1117,2432,1444,2906>... (2 Replies)
I have a Unix file with 200,000 records, and need to remove all records from the file that have the character ‘I' in position 68 (68 bytes from the left). I have searched for similar problems and it appears that it would be possible with sed, awk or perl but I do not know enough about any of these... (7 Replies)
I hopefully have a simple request - I need to process multiple files reformatting the output based on tags at the beginning of each line. So the data for the new 3 lines of the output file are in the HDR line and then the details are in the DTL tagged lines.
for ifile in $indir
do
echo... (1 Reply)
Hello everyone,
Firstly i do not require alot of help.. i am right at the end of finishing my scipt but cannot find a solution to the last part.
What i need to do is, prompt the user for a file to work with, which i have done.
promt the user for an output file - which is done.
#!/bin/bash... (14 Replies)
hello,
new to this forum. but i have a requirement to extract the value from multiple xml node and print out the values to new file with comma seperated. would like to know how this would be done using either sed/perl or some unix script. an example would be tremendous...
sample input file:... (2 Replies)
Hi, I want to get data from Xml file by using sed or awk command. I want to get the following result :
mon titre 1;Createur1;Dossier1
mon titre 1;Createur1;Dossier1
and save it in cvs file (fichier.cvs).
FROM this Xml file (test.xml):
<playlist version="1">
<trackList>
<track>... (1 Reply)
I need to know the way. I have got parsing down some nodes. But I was unable to get the child node perfectly. If you have code please send it. It will be very useful for me. (0 Replies)