i have a string:
...some values...<id1>10052023</id1>...some others...<id2>306689461795</id2>...
i need to replace value between id1 with value from id2, is it possible to do with npp?
i know about groups but i don't know how to use it properly in this case.
my value can be found and stored in group 1 with regex like this:
^.*<id1>(.*)</id1>.*$
am i right?
With xmlstarlet
(available on all platforms):
$ cat file
<root>
...some values...<id1>10052023</id1>...some others...<id2>306689461795</id2>...
</root>
$ xmlstarlet edit -d '//id1/text()' -u '//id1' -x '//id2/text()' file
<?xml version="1.0"?>
<root>
...some values...<id1>306689461795</id1>...some others...<id2>306689461795</id2>...
</root>