Hello,
I have two text files (txt1 and txt2). txt1 contains many lines with a single number in each line. txt2 (xml format) contains information about the numbers given in txt1. I need to insert one line in txt2 within the scope of each number taken from txt1.
Sample problem:
txt1:
12
23
45
67
78
txt2:
<id = "ab">
<>
<"add text here!!!">
</holder>
<>
<num = "12">
<>
<>
<>
<id = "bc">
<>
<"add text here!!!">
</holder>
<>
<num = "78">
<>
<>
<>
<id = "cd">
<>
<>
<>
<"dont add since 90 is not in the txt1">
</holder>
<num = "90">
<>
<>
hope i have not confused much..
---------- Post updated at 04:05 PM ---------- Previous update was at 04:03 PM ----------
so within the scope of each number place the text above the line </holder> for all the numbers present in txt1.
---------- Post updated at 04:11 PM ---------- Previous update was at 04:05 PM ----------
I have been able to insert the line above all the </holder> in the file... But I am stuck when I am matching the numbers from txt1 and inserting into txt2 into a specific location.....
here's the code I used to insert above all lines having </holder>
sed '/</\Holder>/i\<TEXT INSERTED>' filename