Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to change values in xml file? Post 302976884 by s1s2s3s4 on Thursday 7th of July 2016 02:12:41 PM
Old 07-07-2016
How to change values in xml file?

Hi Don,
Please see my comment below..
What operating system and shell are you using?
RHEL

Do you just want to change <argument name> tag data if the tag appears between <task-arguments> and </task-arguments> tags; or do you want to change them everywhere they appear?

I want to change the values only the tag b/w <task-arguments> and </task-arguments> tags.

Where do the new values come from? Is there a configuration file? Are they given as command-line arguments? Are they to be hardcoded in your script?

Those values are coming from configuration file..

Are only the values shown in the example to be replaced, or are all values found in your input file to be replaced?

All the values to be replaced which are b/w the tag.

What is the name of your XML file? Is the name to be given as a parameter to your script? Is the name to be hard coded into your script?
monitor.xml and the value is hard coded

What have you tried to solve this problem on your own?
tried like below

Code:
sed -i '/<argument\s\+name="hostname"/s/is-required="*.*"/is-required="$REQ1" default-value="$hostname"/' $file



Moderator's Comments:
Mod Comment Please use code tags as required by forum rules!

Last edited by RudiC; 07-07-2016 at 04:09 PM.. Reason: Added code tags.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Extracting values from an XML file

Hello People, I have an xml file from which I need to extract the values of the parameters using UNIX shell commands. Ex : Input is like : <Name>Roger</Name> or <Address>MI</Address> I need the output as just : Roger or MI with the tags removed. Please help. (1 Reply)
Discussion started by: sushant172
1 Replies

2. Shell Programming and Scripting

Change values in Log4j.xml using ksh script

Hi, I am new to UNIX and shell scripting. I have to create a shell script(ksh) which parses log4j.xml file for a given webservice name and change the corresponding value from INFO to DEBUG or vice-versa. My log4j.xml looks like:- <!-- Appender WEBSERVICENAME--> <appender... (3 Replies)
Discussion started by: sanjeevcseng
3 Replies

3. Shell Programming and Scripting

Need help to change XML values with shell scripting for Network Simulation

Hello, I don't have experience in this scripting and I need some help to read a value from an XML file and change it with a random number to use in simulator for different network scenarios. </Description><sim_comm_rounds>35</sim_comm_rounds><num_clusters>1</num_clusters><Clocking> I want to... (5 Replies)
Discussion started by: erhanasd
5 Replies

4. Shell Programming and Scripting

Need help to change values in XML using Python? noob help pls!

Hello I am a noob in XML and Python. I am trying to do this for my MSc project about a network simulation and need some help.... I want to change the values shown below: <num_crash_failures>1</num_crash_failures> −<crash_failure_entry> <freeze_at_slot>0</freeze_at_slot>... (0 Replies)
Discussion started by: erhanasd
0 Replies

5. Shell Programming and Scripting

Extract values from an XML File

Hi, I need to capture all the attributes with delete next to it. The source XML file is attached. The output should contain something like this below: Attributes = legacyExchangeDN Action = Delete Username = Hero Joker Loginid = joker09 OU =... (4 Replies)
Discussion started by: prvnrk
4 Replies

6. Shell Programming and Scripting

Comparing delta values of one xml file in other xml file

Hi All, I have two xml files. One is having below input <NameValuePair> <name>Daemon</name> <value>tcp:7474</value> </NameValuePair> <NameValuePair> <name>Network</name> <value></value> </NameValuePair> ... (2 Replies)
Discussion started by: sharsour
2 Replies

7. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

8. UNIX for Dummies Questions & Answers

Reading Xml file and print the values into the text file in columnwise?

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies

9. Shell Programming and Scripting

Grep some values from XML file

Dear community, I have a big XML log file containing several rows splitted by tag: <ActivityLogRecord> and </ActivityLogRecord>. An example below. What I need is read the file and extract some value from each tags and put them into one line (each line for every <ActivityLogRecord> tag). So... (5 Replies)
Discussion started by: Lord Spectre
5 Replies
SPLASHY-CONFIG.XML(5)					 Splashy POSIX boot splash system				     SPLASHY-CONFIG.XML(5)

NAME
Splashy - a user-mode, POSIX and LSB compliant, boot splashing system for UNIX. SYNOPSIS
/etc/splashy/config.xml - Splashy's configuration file DESCRIPTION
/etc/splashy/config.xml sets splashy's behaviour during boot, shutdown inter-runlevel and error. It is an XML file where all values are enclosed in tags A tag is anything enclosed between < and >. An opening tag has the form "<tag>" while a closing tag has its name preceded with a backslash () character as in "< ag>" Tags can be considered as folders. Each tag either contains tags or contains a value The value of the final tag affects in the field defined by its parents tags The following tag folders are supported: <splashy> This tag is mandatory. It contains all splashy's configuration values, listed below. The following values are supported: <themes> Absolute path to the directory containing the installed splashy themes. Default: /etc/splashy/themes <current_theme> Name of the theme to use. It must be the name of a directory in <themes>'s value's directory. Default: default <default_theme> Full path to a theme to fall back to if the theme specified in <current_theme>'s value can't be found. Default: /etc/splashy/themes/default <pid> Full path to the PID file splashy will use to store its PID so that other processes can know if it is running. Default: /var/run/splashy.pid Comments can be introduced by enclsing them between <!-- and -->. Blank lines are also ignored EXAMPLES
The following is a complete and valid splashy configuration file: <splashy> <!-- themes directory: conventional path /etc/splashy/themes --> <themes>/etc/splashy/themes</themes> <!-- current theme could be relative the themes defined above or full path --> <current_theme>default</current_theme> <!-- full path to theme to fall back in case of problems. DO NOT CHANGE --> <default_theme>/etc/splashy/themes/default</default_theme> <!-- this defaults should be ok --> <pid>/var/run/splashy.pid</pid> </splashy> NOTES
Values are refered by their tag name prefixed with all of its parent tag's names. For example: "/splashy/pid" FILES
/etc/splashy/config.xml Main configuration. Defines how splashy should be setup /etc/splashy/themes/ Location where splashy themes are stored SEE ALSO
splashy(1), splashy_config(1), splashy_config(1), splashy-theme.xml(5) AUTHORS
Jacobo Vilella <jacobo221@gmail.com> perl v5.12.1 2010-07-05 SPLASHY-CONFIG.XML(5)
All times are GMT -4. The time now is 01:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy