I want to add a commentline inside a xml file above the node using xmlstartlet
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book>
<title lang="en" id="1">Harry Potter</title>
<price>29.99</price>
</book>
</bookstore>
I like to achieve this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- xml created by Stackoverflow-->
<bookstore>
<book>
<title lang="en" id="1">Harry Potter</title>
<price>29.99</price>
</book>
</bookstore>
I tried:
xmlstartlet ed -i /bookstore -t text -n <!--xml created by Stackoverflow--> -v "" test.xml
But gives error -bash: !--xml created by Stackoverflow--: event not found
hope someone can help.