Sponsored Content
Top Forums Shell Programming and Scripting Find Node and replace line(s) preceding in xml file Post 302638101 by umarsatti on Thursday 10th of May 2012 12:39:16 AM
Old 05-10-2012
Find Node and replace line(s) preceding in xml file

Hello,

I have an xml file whose contacts are like below:

<Node>Apple
<B>Value1</B>
<B>Value2</B>
<B>Value3</B>
</Node>
<Node>Mango
<B>Value1</B>
<B>Value2</B>
<B>Value3</B>
</Node>
<Node>Apple
<B>Value1</B>
<B>Value2</B>
<B>Value3</B>
</Node>
<Node>Bannana
<B>Value1</B>
<B>Value2</B>
<B>Value3</B>
</Node>

I would like to find/grep Node type "Apple" and than would like to change "value3" to "value4" of Node Apple only in this xml file. Is it possible that I can do it through sed or any other scripting utility?

Any help would be highly appreciated. Thanks in advance!! Smilie

BR,
Umar

Last edited by umarsatti; 05-10-2012 at 01:57 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell call xalan to transform xml with xslt, but can not find root node

hi experts: i am using xslt to transform xml in shell. But can not find root node of source xml, if i remove the naming space definition in source xml, it works fine. So our the question is how to let xslt know the naming space of srouce xml file? Thanks for your kindly help in... (0 Replies)
Discussion started by: summer_cherry
0 Replies

2. Shell Programming and Scripting

Find/Replace in XML file

I am not sure how to approach this find/replace using a shell script. Any help or guidance appreciated. I want to find this: <objects/> <thumb>thumb_0001.jpg</thumb> <preview>preview_0001.jpg</preview> And replace with something like this: <objects>... (1 Reply)
Discussion started by: jimraynor
1 Replies

3. Shell Programming and Scripting

Mutli line pattern search & replace in a xml file

Hello guys, I need your help for a specific sed command that would search for a multi line pattern and if found, would replace it by another multi line pattern. For instance, here is the input: <RefNickName>abcd</RefNickName> <NickName>efgh</NickName> <Customize> ... (0 Replies)
Discussion started by: xciteddd
0 Replies

4. Shell Programming and Scripting

find and replace a line in a file

Hi, I am want find and replace in following content in the file. i want to repalce a word TABLESPACE XCRM_<ANY_CHAR> to TABLESPACE XCRM Sample File to Replace : LOB(COMPLEX_VALUE) STORE AS ( TABLESPACE XCRM_MED_D_NEW STORAGE(INITIAL 64K BUFFER_POOL DEFAULT) ENABLE... (3 Replies)
Discussion started by: gavemani
3 Replies

5. UNIX for Dummies Questions & Answers

Script to find line in one file and replace in another

Hey Guys, im looking for a script that will work under OSX. What i want to do is copy information from one file (Specific LIne) and write it to a certain line in another. To be more specific... I want the hostname of a mac to be gathered ( i assume its stored in a .plist file somewhere) and... (2 Replies)
Discussion started by: padgo
2 Replies

6. Shell Programming and Scripting

Find the closest value in another csv file preceding it and following it?

Hi, Is this possible? I want to take a csv file and find the closest value in another csv file preceding it and following it. For ex. In this csv file, I'll take the first line: 1309341156.800000000 1309341156.802500000 1309341156.805000000 1309341156.807500000 and find the closest... (2 Replies)
Discussion started by: superbbrr
2 Replies

7. Shell Programming and Scripting

Find and replace last line in a file

Hi I am having a file which has like this content shown below Aaa,bb,cc,dd Xxx,yy,d,12 Dodd,12-Jun,t I need to replace last line like this Aaa,bb,cc,dd Xxx,yy,d,12 Dodd,10-August,t (13 Replies)
Discussion started by: rohit_shinez
13 Replies

8. Shell Programming and Scripting

Find and update line in xml file

Hi, I have a xml file that I need to modify 1 line to change some value from 2 to 10 (or any number). Sample input: <!-- some text here> . . . <message:test name="ryan"> <message:sample-channel charset="UTF-8" max-value="2" wait="20"> ... (5 Replies)
Discussion started by: brichigo
5 Replies

9. Shell Programming and Scripting

Looping through XML file on basis of a node

<?xml version="1.0" encoding="UTF-8"?> <Document> <FIToFICstmrCdtTrf> <GrpHdr> <MsgId>10001</MsgId> <NbOfTxs>1</NbOfTxs> <IntrBkSttlmDt>2015-05-06</IntrBkSttlmDt> <SttlmInf> <SttlmMtd>CLRG</SttlmMtd> </SttlmInf> <PmtTpInf> ... (2 Replies)
Discussion started by: harish2015
2 Replies

10. UNIX for Beginners Questions & Answers

Find replace text in xml file on the fly

Dear Unix guru, I have a .XML file which is being used to load data to oracle. This file comes on unix box and one of the tag in xml is oracle key word. I want to find that tag and replace with new tag on the fly For example I will get one of the tag in xml is as below <from>Test Test... (12 Replies)
Discussion started by: guddu_12
12 Replies
SubmitDiagInfo(8)					    BSD System Manager's Manual 					 SubmitDiagInfo(8)

NAME
SubmitDiagInfo -- sends diagnostic information to Apple SYNOPSIS
SubmitDiagInfo DESCRIPTION
SubmitDiagInfo is a system process which runs periodically. If the user has opted-in for automatic reporting of diagnostic and usage infor- mation, then SubmitDiagInfo collects and sends to Apple any recent diagnostic information which has not yet been sent to Apple. SubmitDiagInfo also cleans up any diagnostic and usage information which was created more than one month ago and is no longer needed. Sending diagnostic and usage reports to Apple helps us improve the quality and performance of our products and services. It helps Apple identify common usage trends and issues that enable us to allocate our resources efficiently, and it helps us provide better support services to you and other customers. All of the diagnostic and usage information is collected anonymously from your computer in a way that does not personally identify you. Reports may include the following information: - Details about application or system crashes, freezes, or kernel panics. - Information about events on your computer (e.g. whether a certain function, such as waking your computer was successful or not). - Usage information (e.g. data about how Apple and third party software, hardware and services are being used). Automatic reporting of diagnostic information is off by default and no information is sent to Apple unless a user has opted-in to automatic collection of diagnostic information. A user is offered the opportunity to opt-in for automatic collection of additional diagnostic and usage information after the user has manually sent a crash, hang or panic report to Apple. Users may at any time opt in or out of automatic reporting in the Security & Privacy pane of the System Preferences application under the "Privacy" tab. All diagnostic and usage information which is eligible for automatic reporting is visible in the Console application under the "DIAGNOSTIC AND USAGE INFORMATION" heading in the application's sidebar. (The information appears here even if a user has not yet opted-in for automatic reporting.) For security purposes, some system diagnostic information will only be visible to admin users and will only be submitted when an admin user is logged in. Users who need technical support should use http://www.apple.com/support or other authorized support channels. Developers who are ADC mem- bers should submit bug reports using http://bugreporter.apple.com in order to allow for two way communication between Apple and the bug reporter. SEE ALSO
ReportCrash(8) Mac OS June 2, 2019 Mac OS
All times are GMT -4. The time now is 12:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy