I wanted the get data from xml tags to script file, but data is in hexadecimal characters line(&
>
) which needs are to be converted to form (&& >).
Example:
<project>
<code><shell> if a && b </shell></code>
</project>
I am able to extract tags using command
xmlstarlet edit --update 'project/code/shell' --value "$DATA" shell.xml > shell.sh
cat shell.sh
Actual:
if a && b
Expected:
if a && b
How to acheive expected result?
To unescape special XML characters:
echo ' if a && b ' | xmlstarlet unescape
Output:
if a && b
cat file.xml | xmlstarlet unescape
Output:
<project>
<code><shell> if a && b </shell></code>
</project>