How to insert subnode in xml file using xmlstarlet or any other bash command?
I have multiple xml files where i want to update a subnode if the subnode project points to different project or insert a subnode if it doesn't exist using a xmlstarlet or any other command that can be used in a bash script.
I have been able to update the subnode project if it doesn't point to the right project using xml starlet command, but i am not able to insert subnode project if the project tag doesn't exist.
I have tried.
The file looks like:
I want the output to look like:
The starlet command i used doesn't have any effect on the file. how can i fix the above problem? any pointers would be great help
Hi. Thanks for any help with this. I'm not new to programming but I am new to shell programming. I need a script that will
1. execute 'df -k' and return the volume names with specific text
2. surround each line of the above results in opening and closing xml tags
3. insert the results of step... (5 Replies)
I have a xmlfile like this:
<?xml version="1.0" encoding="utf-8"?>
<contentlocation xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns="http://wherein.yahooapis.com/v1/schema" xml:lang="en">
<processingTime>0.001538</processingTime>
... (1 Reply)
Hello,
I have the following variables set in my env
echo $MY_XSD_FILE
/home/jak/sample.xsd
echo $MY_INTERVAL_VALUE
4
I want to insert them between the xml tags in my xml file
cat sample.xml
:::::::::::::::
:::::::::::::::
<property name="FILE"></property>
:::::::::::::::::::::::... (2 Replies)
Hi,
i have an xml file and i want to edit a new sub node in a file
like
val="<activity android:label="@string/app_name" android_name=".MainActivity1" android:launchMode="singleTask" android:screenOrientation="portrait"
... (1 Reply)
Hi folks
I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file.
It all works - apart from the xml and config file format in the new file
with XML files the original XML (that ends up in... (2 Replies)
Hi All,
I need a help on inserting a XML tag.
Actual input
<var>
<nam>abcd</nam>
<a1>.</a1>
</var>
if tag <a1>.</a1> is getting missed in XML like below
<var>
<nam>abcd</nam>
</var>
i need to insert wherever it is missed after <nam> tag and before </var> tag.
Could anyone... (3 Replies)
Having a little trouble getting this to work just right.
I have xml files that i want to split some data.
I have 2 <name> tags within the file
I would like to take only the first tag and split the data.
tag example.
From this.
TAB<Name>smith, john</Name>
to
TAB<Name>smith,... (8 Replies)
hi all
i have a problem in the bash shell. i'd like insert in a variable a file for example :
i have a file datafine.log in this file there is :
17/JUN/2019
i want to insert the value of datafine.log in a variable.
Regards
Frncesco
edit by bakunin: please use CODE-tags for your data... (2 Replies)
I currently have a loop that reads all .bam files in a directory (wont always be 4 like in this example,
into $id. What I am trying to do, unsucessfully, is create specific new lines in an exsisting command using
each $id. Each new line would be:
--bam ${id} \
Tried
p=$dir... (8 Replies)
Discussion started by: cmccabe
8 Replies
LEARN ABOUT CENTOS
crm_diff
PACEMAKER(8) System Administration Utilities PACEMAKER(8)NAME
Pacemaker - Part of the Pacemaker cluster resource manager
SYNOPSIS
crm_diff original_xml operation [options]
DESCRIPTION
crm_diff - A utility for comparing Pacemaker configurations (XML format)
The tool produces a custom (diff-like) output which it can also apply like a patch
OPTIONS
-?, --help
This text
-$, --version
Version information
-V, --verbose
Increase debug output
Original XML:
-o, --original=value
XML is contained in the named file
-O, --original-string=value
XML is contained in the supplied string
Operation:
-n, --new=value
Compare the original XML to the contents of the named file
-N, --new-string=value
Compare the original XML to the contents of the supplied string
-p, --patch=value
Patch the original XML with the contents of the named file
Additional Options:
-c, --cib
Compare/patch the inputs as a CIB (includes versions details)
-f, --filter
Suppress irrelevant differences between the two inputs
EXAMPLES
Obtain the two different configuration files by running cibadmin on the two cluster setups to compare:
# cibadmin --query > cib-old.xml
# cibadmin --query > cib-new.xml
Calculate and save the difference between the two files:
# crm_diff --original cib-old.xml --new cib-new.xml > patch.xml
Apply the patch to the original file:
# crm_diff --original cib-old.xml --patch patch.xml > updated.xml
Apply the patch to the running cluster:
# cibadmin --patch patch.xml
AUTHOR
Written by Andrew Beekhof
REPORTING BUGS
Report bugs to pacemaker@oss.clusterlabs.org
Pacemaker 1.1.10-29.el7 June 2014 PACEMAKER(8)