'Edit specific object in xml without additional changes in bash
I need edit some value in my xml files. And I use this code:
xmlstarlet ed --inplace -u \
'//some_folder/buildElement[@name="element_name"]/@some_value' \
-v $var_to_change ${PATH}/my_file.xml
And it is working but not like I expected. I mean, my target value is edit correctly, but additional is changed others line f.e. is remove space or added <?xml version="1.0"?>.
Input:
IS: edit element_name value and remove some space in another lines or add tag on 1 line in xml.
Should be:
edit only element_name value
How can I edit only my expected value without any validation of xml or changes in not expected lines?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
