Sponsored Content
Top Forums Shell Programming and Scripting Extract values from xml file script Post 303019556 by Ophiuchus on Monday 2nd of July 2018 02:02:09 AM
Old 07-02-2018
Quote:
Originally Posted by Don Cragun
No. You have not answered our doubts. You gave us sample input in post #1 and you showed us the output you wanted from that input. And, you were given code that produced that output from that input and then you changed your requirements.

In post 4 you gave us new sample input and you said "The output for this input file 2 would be like this:" and you showed us some output. But with that wording, I don't know if you are saying that that is the output you get from some code that has been suggested (but not what you want), that it is the output you get from some other code that you're using (but not what you want), or if it is the output you want from that new input.

Furthermore, you haven't clearly specified whether the original input you provided in post #1 was valid input that did not include data that was needed to trigger special cases that were missing from your original algorithm (and the code you want should still provide the output you said you want from that input in post #1) or if the input you provided in post #1 was not valid input and everything you said about the output you wanted to be produced from that input should be ignored.
Hi Don,

1) The output I show for sample 2 is my desired output for sample file 2, written/edited manually by me not by any other code(I donīt have more codes Smilie ).
2) Yes, input file in post #1 was valid input that did not include data that was needed to trigger special cases. I noticed that was needed to add data to sample file to consider special cases when I tested the Chubler_XLīs code in sample #2.
3) The code provided by Chubler_XL it works for the sample of post #1. The structure of output I was looking for help in post #1 is the same structure of output for sample #2,
but sample #2 includes some other nodes (<XB_Ranges> and <KJ_Ranges>) that have the same name for their sub-children. That makes the script confuses the values in the output. When I tested the Chubler_XL solution in sample #2 I realized the output was not the desired one. In this point I saw was needed to add those other nodes in order to be considered in script.
4) In addition, in real file the nodes <STR_VAL> and <PRO_VAL> go after <PR_Ranges>. Since the real xml is a kind of large with a lot of other nodes, I only focused in the nodes I want to
extract and the sample I created for post #1 was not accurate in the order of nodes.

I hope be more clear.

Thanks for the help and sorry for any inconvenience.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with shell script to extract data from XML file

Hello Scripting Gurus, I need help with extracting data from the XML file using shell script. The data is in a large XML and I need to extract the id values of all completedworkflows. Here is a sample of it. Input and output data is also in the attached text files. <wfregistry>... (5 Replies)
Discussion started by: yajaykumar
5 Replies

2. Shell Programming and Scripting

Extract XML Element Values

I have a rather large file with XML-style content. Each line contains one full XML entry. For example: 1:<Message><DNIS>1234</DNIS><UCID>3456</UCID><TransferGroup>XYZXYZ</TransferGroup></Message> 2:<Message><DNIS>9999</DNIS><UCID>2584</UCID><TransferGroup>ABCABC</TransferGroup></Message>... (1 Reply)
Discussion started by: sharpi03
1 Replies

3. Shell Programming and Scripting

KSH Script to Get the <TAG Values> from an XML file

Hi All, I am new to Unix I need a KSH script to get the values from XML file to write to a temp file. Like the requirement is from the below TAG <MAPPING DESCRIPTION ="Test Mapping" ISVALID ="YES" NAME ="m_test_xml" OBJECTVERSION ="1" VERSIONNUMBER ="1"> I need the MAPPING DESCRIPTION... (3 Replies)
Discussion started by: perlamohan
3 Replies

4. Shell Programming and Scripting

Perl script to extract 'ID' From XML File

File1.xml <?xml version.........> - <abcd:abcd_list version="1" www.john_uncle's_server.com" xmlns: - <device id="100"> <firmware>12.4(3d)</firmware> <location id="500">Sitting Room</location> </device> - <device id="101"> <firmware>12.4(3d)</firmware> <location id="501">Class... (1 Reply)
Discussion started by: sureshcisco
1 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

Get multiple values from an xml file using one of the following commands or together awk/perl/script

Hello, I have a requirement to extract the value from multiple xml node and print out the values to new file to compare. Would be done using either awk/perl or some unix script. For example sample input file: ..... ..... <factories xmi:type="resources.jdbc:DataSource"... (2 Replies)
Discussion started by: slbmind
2 Replies

7. Shell Programming and Scripting

Passing values to an XML file from shell script

:wall: Hi, I have an XML file with 5 tags. I need to pass values to the XML file from a shell script that will replace values in 2 of the tags. I cannot hardcode the tag values in XML and use replace command in script as the values are likely to change. Please help !!!!!!!!!!! (2 Replies)
Discussion started by: Monalisaa
2 Replies

8. 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

9. Shell Programming and Scripting

How to extract xml attribute values using awk inline.?

I am trying to extract specific XML attribute values for search pattern <factories.*baseQueueName' from resources.xml. my scripts works ok,, but to extract 3 values this code does echo $line three times, it could be 'n' times. How can I use awk to extract matching pattern values in-line or... (11 Replies)
Discussion started by: kchinnam
11 Replies
AUCONVERT(1)						      General Commands Manual						      AUCONVERT(1)

NAME
auconvert - perform various conversion operations on sound files SYNOPSIS
auconvert [-file <format>] [-data <format>] [-rate <sample rate>] [-comment <comment>] [-raw <data format> <num tracks>] [-volume <per- cent>|`max'] [-?] [<input file>] [<output file>] DESCRIPTION
The auconvert program can be used to convert from one sound file format, and/or data format to another. It can also change the comment, sampling rate, and volume of a sound file. Finally, auconvert can be used to convert raw audio data into a sound file. If no input file name is given, standard input will be used. If no output file name is given, the original file will be replaced by the converted file or standard out will be used if the input is coming from standard input. OPTIONS
The following options may be used with auconvert: -file format The output file format. The -? option will display a list of valid file formats. -data format The output data format. The -? option will display a list of valid data formats. Note that each file format may only support selected data formats. -rate sample rate The output sampling rate (in hertz). -comment comment The comment to be stored in the output file. -volume <percent>|`max' The volume option can be used in two ways. If the argument is a percentage, the output file volume will be converted to the speci- fied percentage of the input volume. If the argument is the string `max', the output file volume will be converted to its maximum level. -raw <data format> <num tracks> This option is used to convert raw audio data into a sound file. <data format> is the data format of the raw data. <num tracks> specifies the number of tracks in the raw data. You must also use the -file and -rate options when converting raw data. -? Displays a usage message and a list of supported file and data formats. SEE ALSO
nas(1), auedit(1) COPYRIGHT
Copyright 1993, 1994 Network Computing Devices, Inc. AUTHOR
Greg Renda, Network Computing Devices, Inc. 1.9.3 AUCONVERT(1)
All times are GMT -4. The time now is 07:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy