Hello everyone;
I have plenty of very large (>60Mo) pseudo-xml files which looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
... more lines here
</ObjectStyle>
<Object type="Field" flags="67108864" flags="67108864">
<Style>128</Style>
<Bounds top=" 24" left="138" bottom=" 38" right="391"/>
<FieldObj numOfReps="1" flags="32" input="0" Type="0">
<Name>Isotype</Name>
<Info>
<Field name="Isotype" id="33759" rep="1" max="1" tab="Reagent"/>
</Info>
</FieldObj>
</Object>
... etc
-------------------------------------------------
My goal is to insert in every line begining with "<Object type=" a combination of values located 6 lines further in the file.
Desired output:
<?xml version="1.0" encoding="UTF-8"?>
... more lines here
</ObjectStyle>
<Object type="Field" name="Obj.Reagent.Isotype" flags="67108864">[tab]<--- Target
<Style>128</Style>
<Bounds top=" 24" left="138" bottom=" 38" right="391"/>
<FieldObj numOfReps="1" flags="32" input="0" Type="0">
<Name>Isotype</Name>
<Info>
[COLOR=blue yellow]<Field name="Isotype" id="33759" rep="1" max="1" tab="Reagent"/>[/color][tab]<--- Source
</Info>
</FieldObj>
</Object>
... etc
is this possible to achieve???
I'd try to play with
Code:
awk '/Field name=\"/{print p[(NR+1)%6]}{p[(NR+1)%6]=$0}'
and
awk 'BEGIN {FS="(=\"|\" |\"\/)"} /<Field name=\"/{print "name=\"".$10"_"$2}'
Thanks in advance for any input and assistance.
(awk version 20040207 - Mac OS 10.4.11)