M
M
MuhaMed2012-12-13 01:08:17
Automation
MuhaMed, 2012-12-13 01:08:17

Synchronizing files by excluding some lines?

There is a PLIST file. It contains fields that are repeated many times.

<key>background_0</key>
    <dict>
        <key>Type</key>
        <string>Picture</string>
        <key>Position</key>
        <string>{239.5,160}</string>
        <key>Sizes</key>
        <string>{480,320}</string>
        <key>Scale</key>
        <string>{1.0,1.0}</string>

Let's say I create the same file, with the same structure, but with different values ​​in Position and Sizes. It is necessary to unite two files by taking only these fields (lines) from the second. And leave other fields (Scale, Type) unchanged, even if they exist.
For example I have a file
A A
B B

i will create a new file
C C
D D

I will exclude the first row from the union and in the end it should turn out
A A
D D

I know that there is a SED language, but I do not know how it can help me

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MuhaMed, 2012-12-13
@MuhaMed

Tortoise

D
doranych, 2012-12-13
@doranych

Judging by the syntax, it's a stretch to call it xml files, not standardized, but nonetheless.
Parse both files as XML objects, reassign the values ​​(sorry for the pun) in the original object, and output it to the resulting file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question