Sponsored Content
Full Discussion: Modify xml using sed or awk
Top Forums Shell Programming and Scripting Modify xml using sed or awk Post 302898141 by wamqemail2 on Saturday 19th of April 2014 02:04:26 AM
Old 04-19-2014
Modify xml using sed or awk

Hi All,

I want to modify(changing the status from "on" to "off" status of [GoogleOverhaul] Stage-element value from the below xml file using sed or awk:

File Name: global.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>

<config>
  <widget>
        <name>HTTP-POOL</name>
        <attributes>
            <maxconnections>5000</maxconnections>
            <connectionsperhost>50</connectionsperhost>
            <sockettimeout>1000</sockettimeout>
            <connectiontimeout>200</connectiontimeout>
            <status environment="mwh">on</status>
            <status environment="las">on</status>
            <status environment="iad">on</status>
            <status environment="dub">on</status>
            <status environment="lon">on</status>
            <status environment="hkg">on</status>
            <status environment="development">on</status>
            <status environment="staging">on</status>
            <status environment="testlab-1">on</status>
            <status environment="perflab">on</status>
        </attributes>
    </widget>
  <widget>
    <name>GoogleOverhaul</name>
    <attributes>
        <status environment="mwh">on</status>
        <status environment="las">on</status>
        <status environment="iad">on</status>
        <status environment="dub">off</status>
        <status environment="lon">off</status>
        <status environment="hkg">off</status>
        <status environment="development">on</status>
        <status environment="staging">on</status>
        <status environment="testlab-1">off</status>
        <status environment="perflab">off</status>
    </attributes>
</widget>
 <widget>
        <name>RA</name>
        <attributes>
            <status environment="mwh">off</status>
            <status environment="las">off</status>
            <status environment="iad">off</status>
            <status environment="hkg">off</status>
            <status environment="dub">off</status>
            <status environment="lon">off</status>
            <status environment="development">off</status>
            <status environment="staging">off</status>
            <status environment="testlab-1">off</status>
            <status environment="perflab">off</status>
        </attributes>
    </widget>
</config>

Thanks for any help.

Last edited by Scrutinizer; 04-19-2014 at 07:09 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

modify and use awk sed program

The following awk script creates a file b.dat. awk '{print substr($0,1,27),substr($2,index($2,"_")+1)," ",substr($0,49)}' a.dat > b.dat I need this script to be modified to also sum $3 values by distinct $1 and $2 fields. Current file W2_2009275 2 8 W2_2009275 2 7 W1_2009275 1... (3 Replies)
Discussion started by: mnnarendra
3 Replies

2. Shell Programming and Scripting

parsing xml with awk/sed

Hi people!, I need extract from the file (test-file.txt) the values between <context> and </context> tag's , the total are 7 lines,but i can only get 5 or 2 lines!!:confused: Please look my code: #awk '/context/{flag=1} /\/context/{flag=0} !/context/{ if (flag==1) p rint $0; }'... (3 Replies)
Discussion started by: ricgamch
3 Replies

3. Shell Programming and Scripting

Sed or Awk for modify hour in a crontab AIX

Hi, I want to modifiy the hour in the crontab AIX 5.3 for this line: Input: 00 22 * * * /outillage/script_exploit/bin/SavOffline.ksh > /dev/null 2>&1 Output: 30 20 * * * /outillage/script_exploit/bin/SavOffline.ksh > /dev/null 2>&1 With the awk or sed function through a ssh -q... (1 Reply)
Discussion started by: khalidou13
1 Replies

4. Shell Programming and Scripting

Using SED/AWK to extract xml at end of file

Hello everyone, Firstly i do not require alot of help.. i am right at the end of finishing my scipt but cannot find a solution to the last part. What i need to do is, prompt the user for a file to work with, which i have done. promt the user for an output file - which is done. #!/bin/bash... (14 Replies)
Discussion started by: hugh86
14 Replies

5. Shell Programming and Scripting

Need help in using sed/awk for line insertion in xml

Hello, I have two text files (txt1 and txt2). txt1 contains many lines with a single number in each line. txt2 (xml format) contains information about the numbers given in txt1. I need to insert one line in txt2 within the scope of each number taken from txt1. Sample problem: txt1: 12 23... (1 Reply)
Discussion started by: shekhar2010us
1 Replies

6. Shell Programming and Scripting

XML- Sed || Awk Bash script... Help!

Hi ! I'm working into my first bash script to make some xml modification and it's going to make me crazy lol .. so I decide to try into this forum to take some ideas from people that really know about this! This is my situation I've and xml file with a lots of positional values with another tags... (9 Replies)
Discussion started by: juampal
9 Replies

7. UNIX for Dummies Questions & Answers

xml to csv using sed and awk command

Hi Guys, Can you help me in creating shell script using sed,awk etc commands to generate csv file using xml file. (5 Replies)
Discussion started by: sbk
5 Replies

8. Shell Programming and Scripting

Modify the file with awk,sed or perl

Hi All, I need help from any of you.Would be so thankful for your help. I/P DDDD,1045,161,1557,429,1694,800,1911,1113,2460,1457,2917> 1609,3113,1869,3317,2732,3701,3727,4132,5857,5107> 9004,6496 DDDD,1125,157,1558,429,1694,800,1911,1117,2432,1444,2906>... (2 Replies)
Discussion started by: Indra2011
2 Replies

9. Shell Programming and Scripting

Using awk and sed to modify a create sql script

Hi, I have a file which contains the following data claim_src|clm_id,typ_id pat_src|pat_id prov_src|prov_id,clm_id,prov_name The first field is table name and second field is primary keys of the table Now I have three files which contain ddl of each table. clam_src.sql... (4 Replies)
Discussion started by: wahi80
4 Replies

10. UNIX for Beginners Questions & Answers

Sed, awk or another bash command to modify string with the content of another file

Hello everybody, I would like modify some strings using sed or another command line with the content file. For example: - {fqdn: "server-01" , ip: "server-01"} - {fqdn: "server-02" , ip: "server-02"} - {fqdn: "server-03" , ip: "server-03"} - {fqdn: "server-04" , ip: "server-04"} My... (4 Replies)
Discussion started by: dco
4 Replies
XML-XREAD(1)							   User Commands						      XML-XREAD(1)

NAME
xml-xread - Parse XML documents with entity and URI resolution SYNOPSIS
xml-xread [options] xmlfile DESCRIPTION
xml-xread is a simple command line tool for parsing and validating XML documents. It is not an actual XML parser, it just wraps around a JAXP XMLReader, adding support for catalog-based entity and URI resolution. OPTIONS
-c catalogfile Load a particular catalog file. May be specified multiple times. -v Perform a validating parse. This is the default. -w Perform a well-formed parse, not a validating parse. -N Perform a namespace-aware parse. This is the default. -n Perform a namespace-ignorant parse. -d debuglevel Set the debug level (an integer). Warnings are shown if the debug level is set to greater than 2. -E maxerrors Set the maximum number of errors to display. The default is 10. FILES
/etc/java/resolver/CatalogManager.properties The central catalog manager configuration file used by xml-xread. SEE ALSO
xml-parse(1), xml-resolver(1), java(1), the OASIS entity resolution technical committee home page at <http://www.oasis-open.org/commit- tees/entity/>. AUTHOR
Norman Walsh <Norman.Walsh@Sun.COM> 1.1 July 2004 XML-XREAD(1)
All times are GMT -4. The time now is 02:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy