Find and replace between Tags

I have Text file that contain 12K <issues> tags , on Each issue tag I would like issue number key will replace by stringValue of @customFields.57

for example Before

<issues nativeId="972681" key="XXX-18122" creator="/0/@users.49" reporter="/0/@users.27" assignee="/0/@users.27" issueType="/0/@issueTypes.0" summary="hours"  priority="/0/@priorities.2" status="/0/@statuses.2" created="2020-09-24T01:03:06.000-0700" updated="2020-10-26T01:25:02.000-0700" fixVersions="/0/@projects.0/@versions.270" components="/0/@projects.0/@components.39">
    <customFieldValues customField="/0/@customFields.56" stringValue="82294" reference="/0/@customFields.56/@contexts.0/@options.4"/>
    <customFieldValues customField="/0/@customFields.57" stringValue="28162"/>
    <customFieldValues customField="/0/@customFields.58" stringValue="0"/>
    updateAuthor="/0/@users.41" created="2020-09-28T02:46:30.000-0700" updated="2020-09-28T02:46:30.000-0700"/>

After

<issues nativeId="972681" key="XXX-28162" creator="/0/@users.49" reporter="/0/@users.27" assignee="/0/@users.27" issueType="/0/@issueTypes.0" summary="hours"  priority="/0/@priorities.2" status="/0/@statuses.2" created="2020-09-24T01:03:06.000-0700" updated="2020-10-26T01:25:02.000-0700" fixVersions="/0/@projects.0/@versions.270" components="/0/@projects.0/@components.39">
    <customFieldValues customField="/0/@customFields.56" stringValue="82294" reference="/0/@customFields.56/@contexts.0/@options.4"/>
    <customFieldValues customField="/0/@customFields.57" stringValue="28162"/>
    <customFieldValues customField="/0/@customFields.58" stringValue="0"/>
    updateAuthor="/0/@users.41" created="2020-09-28T02:46:30.000-0700" updated="2020-09-28T02:46:30.000-0700"/>

Any idea how can make it ? I think we need to put any Text between tags into arrays and make copy manipulation into any array.



Read more here: https://stackoverflow.com/questions/64946303/find-and-replace-between-tags

Content Attribution

This content was originally published by Shlomi Cohen at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: