Sponsored Content
Full Discussion: Read data in XML file
Top Forums Shell Programming and Scripting Read data in XML file Post 302352171 by swame_sp on Thursday 10th of September 2009 03:07:24 PM
Old 09-10-2009
Question Read data in XML file

Hello Everybody,

I have a question on reading the data from XML file through KSH shell script. In the below file I need to collect the patient control no and its respective insured id. I need to have pair of these values in single line separated by some special character, so that I could use them later.

Kindly guide me on how to do this.
Code:
<batch status-category="A1">
              <billing-provider-npi>1871606764</billing-provider-npi>
              <total-claims>155</total-claims>
              <total-charges>110048.85</total-charges>
              <claim status-category="A3">
                <error>
                  <error-message>Loop: 2010BC_LOOP Subscriber ID not found on payer file</error-message>
                  <error-record>NM1</error-record>
                  <error-field>09::0067</error-field>
                  <error-code>H241</error-code>
                  <field-contents>ZWP9901514901</field-contents>
                </error>
                <patient-control-no>02G21968276-1</patient-control-no>
                <service-from>20090825</service-from>
                <total-charges>662.00</total-charges>
                <insured-id>ZWP9901514901</insured-id>
              </claim>
              <claim status-category="A3">
                <error>
                  <error-message>Loop: 2010BC_LOOP Subscriber ID not found on payer file</error-message>
                  <error-record>NM1</error-record>
                  <error-field>09::0067</error-field>
                  <error-code>H241</error-code>
                  <field-contents>ZWP800999146</field-contents>
                </error>
                <patient-control-no>02G21968151-1</patient-control-no>
                <service-from>20090824</service-from>
                <total-charges>58.00</total-charges>
                <insured-id>ZWP800999146</insured-id>
              </claim>
              <claim status-category="A1">
                <patient-control-no>02G21983647-1</patient-control-no>
                <service-from>20090827</service-from>
                <total-charges>61.00</total-charges>
                <insured-id>ZWE88003319201</insured-id>
              </claim>

Expecting:
02G21968276-1|ZWP9901514901
02G21968151-1|ZWP800999146

PS: I'm trying to use the commands given in other threads too....
Advance thanks.

Regards,
Swami

Last edited by swame_sp; 09-10-2009 at 04:11 PM.. Reason: Added Exp res
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read xml file

Iam new to shell script. How to read xmlfile using shellscript(without awk),and Store record by record in file . My xml file: <root> <header> <HeaderData1>header1</HeaderData1> <HeaderData2>header2</HeaderData2> </header> <detailsRecord> ... (2 Replies)
Discussion started by: ram2s2001
2 Replies

2. Shell Programming and Scripting

Read elements of a xml file??????

Hi, What is a good way to read elements of an xml file? i did try xmllint it doesnt provide a function to output values of a tree. In the below example when i specify from Family2 I need the name of the father then the output should be DAVE. Appreciate any help provided in this regards. Many... (6 Replies)
Discussion started by: ahmedwaseem2000
6 Replies

3. Shell Programming and Scripting

read and write to xml file

hi i am quite new to shell scripting and need help in reading and writing in xml file i have an xml file with format: <main> <store> <name>ABC</name> <flag>0</flag> <size>123<size> </store> <store> <name>DEF</name> ... (2 Replies)
Discussion started by: kichu
2 Replies

4. Shell Programming and Scripting

script to read XML file

Dear All, I have one log file and it contains lot of XML as below. ... (1 Reply)
Discussion started by: murtujak
1 Replies

5. Shell Programming and Scripting

Help on awk to read xml file

Hello, I have a xml file as shown below. I want to parse the file and store data in variables. xml file looks like: <TEST NAME="DataBaseurl">jdbc:oracle:thin:@localhost:1521:ora10</TEST> <TEST NAME="Databaseuser">Pradeep</TEST> ...... and many other such lines i want to read this file and... (2 Replies)
Discussion started by: pradeepmacha
2 Replies

6. Shell Programming and Scripting

To read a flat file containing XML data

I have a file something like this:aaaa.xml content of the file is 0,<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <storeInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <s> <BRANCH_NO>3061</BRANCH_NO> <BRANCH_NAME>GREEN EXPRESS</BRANCH_NAME> ... (4 Replies)
Discussion started by: kmanivan82
4 Replies

7. Shell Programming and Scripting

Read file excluding XML in it

Hi , I have a file like below.I want all the content in a single line excluding the XML.How can i proceed? t=21 y=23 rg=xyz ..... <xmlstarts> . . <xmlends> lk=99 lo=09 (3 Replies)
Discussion started by: chetan.c
3 Replies

8. UNIX for Advanced & Expert Users

Shell Script to read XML tags and the data within that tag

Hi unix Gurus, I am really new to Unix Scripting. Please help me to create a shell script which reads the xml file and from that i need to fetch a particular information. For example <SOURCE BUSINESSNAME ="" DATABASETYPE ="Teradata" DBDNAME ="DWPROD3" DESCRIPTION ="" NAME... (2 Replies)
Discussion started by: SmilePlease
2 Replies

9. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies
POE::Test::Loops(3pm)					User Contributed Perl Documentation				     POE::Test::Loops(3pm)

NAME
POE::Test::Loops - Reusable tests for POE::Loop authors SYNOPSIS
#!/usr/bin/perl -w use strict; use Getopt::Long; use POE::Test::Loops; my ($dir_base, $flag_help, @loop_modules, $flag_verbose); my $result = GetOptions( 'dirbase=s' => $dir_base, 'loop=s' => @loop_modules, 'verbose' => $flag_verbose, 'help' => $flag_help, ); if ( !$result or !$dir_base or $flag_help or !@loop_modules ) { die( "$0 usage: ", " --dirbase DIR (required) base directory for tests ", " --loop MODULE (required) loop modules to test ", " --verbose show some extra output ", " --help you're reading it ", ); } POE::Test::Loops::generate($dir_base, @loop_modules, $flag_verbose); exit 0; DESCRIPTION
POE::Test::Loops contains one function, generate(), which will generate all the loop tests for one or more POE::Loop subclasses. The "SYNOPSIS" example is a version of poe-gen-tests, which is a stand-alone utility to generate the actual tests. poe-gen-tests also documents the POE::Test::Loops system in more detail. FUNCTIONS
generate( $DIRBASE, @LOOPS, $VERBOSE ) Generates the loop tests. DIRBASE is the (relative) directory in which a subdirectory for each of the LOOPS is created. If VERBOSE is set to a TRUE value some progress reporting is printed. POE::Test::Loops::generate( "./t", [ "POE::Loop::Yours" ], 1, ); SEE ALSO
POE::Loop and poe-gen-tests. AUTHOR &; COPYRIGHT See poe-gen-tests. perl v5.14.2 2012-03-11 POE::Test::Loops(3pm)
All times are GMT -4. The time now is 06:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy