Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Delete a record in a xml file using shell scripting Post 302659427 by sdesstp on Thursday 21st of June 2012 02:00:14 AM
Old 06-21-2012
The script is working fine but when the first record itself contains isup , the initial tags are also deleted. How to overcome this and also the script should work for a batch of xml files in a folder
Kindly help. Thanks in advance

---------- Post updated at 11:30 AM ---------- Previous update was at 11:02 AM ----------

The script is running fine but when the isup pattern appears in the first record itself the initial tags also getting deleted . Also the script has to run for a batch of xml files . Kindly help
The initial tags are like below
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ecapreport SYSTEM "ecapreport.dtd">
<ecapreport>
  <stp>bsnlstpekm</stp>
  <collector>ekmecap1A</collector>
  <startdate>07082011</startdate>
  <starttime>235500</starttime>
  <enddate>08082011</enddate>
  <endtime>000000</endtime>

  <record>
    <signallingstandard>ITU-I</signallingstandard>
    <linkid>1225</linkid>
    <si>isup</si>
    <mtp>
      <opc>004-009-004</opc>
      <dpc>004-048-000</dpc>
    </mtp>
    <msucount>2</msucount>
    <octcount>72</octcount>
  </record>

  <record>
    <signallingstandard>ITU-I</signallingstandard>
    <linkid>1225</linkid>
    <si>isup</si>
    <mtp>
      <opc>004-009-004</opc>
      <dpc>002-056-000</dpc>
    </mtp>
    <msucount>56</msucount>
    <octcount>1009</octcount>
  </record>


Last edited by pludi; 06-21-2012 at 05:32 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for searching a record,copy to a file and then delete it

Hi, I have a requirement in hand: I have a file with millions of records say file 1.I have another file, say file 2 which has 2000 records in it. The requirement is to read file2 , and remove the read record from file 1 and move i to a seperate file, file 3. For eg: Read file 2, get the... (5 Replies)
Discussion started by: kumara2010
5 Replies

2. Shell Programming and Scripting

XML to Text file Parsing Using shell scripting

Hi folks, Need some help with XML to text file parsing , the following is the content of the XML File. <xn:SubNetwork id="SNJNPRZDCR0R03"> <xn:MeContext id="PRSJU0005"> <xn:VsDataContainer id="PRSJU0005"> <xn:attributes> ... (6 Replies)
Discussion started by: tech_frk
6 Replies

3. Solaris

XML to Text file Parsing Using shell scripting

Hi, I want to parse an XML File using Shell Script preferably by using awk command, I/P file is : <gn:ExternalGsmCell id="016P3A"> <gn:attributes> <gn:mnc>410</gn:mnc> <gn:mcc>310</gn:mcc> <gn:lac>8016</gn:lac> ... (2 Replies)
Discussion started by: tech_frk
2 Replies

4. Shell Programming and Scripting

How to add trailer record at the end of the flat file in the unix ksh shell scripting?

Hi, How to add trailer record at the end of the flat file in the unix ksh shell scripting can you please let me know the procedure Regards Srikanth (3 Replies)
Discussion started by: srikanth_sagi
3 Replies

5. Shell Programming and Scripting

How to extract data from xml file using shell scripting?

Hi evry1, This is my 1st post in this forum.Pls help me I want to extract some data froma xml file which has 2000 lines using shell scripting. Actually my xml file has some "audio and video codes" which i need to arrange in a column wise format after extracting it using shell scripting.I... (4 Replies)
Discussion started by: arun_kohan
4 Replies

6. Shell Programming and Scripting

How to extract data from XML file using shell scripting?

Hi , I have input file as XML. following are input data #complex.xml Code: <?xml version="1.0" encoding="UTF-8"?><TEST_doc xmlns="http://www.w3.org/2001/XMLSchema-instance"> <ENTRY uid="123456"> <protein> <name>PROT001</name> <organism>Human</organism> ... (1 Reply)
Discussion started by: arun_kohan
1 Replies

7. Shell Programming and Scripting

Extract timestamp from first record in xml file and it checks if not it will replace first record

I have test.xml <emp><id>101</id><name>AAA</name><date>06/06/14 1811</date></emp> <Join><id>101</id><city>london</city><date>06/06/14 2011</date></join> <Join><id>101</id><city>new york</city><date>06/06/14 1811</date></join> <Join><id>101</id><city>sydney</city><date>06/06/14... (2 Replies)
Discussion started by: vsraju
2 Replies

8. UNIX for Advanced & Expert Users

How can i populate the record in to table using shell scripting?

LOG_DIR=/app/rpx/jobs/scripts/just/logs sendEmail() { pzCType="$1"; pzTitle="$2"; pzMsg="$3"; pzFrom="$4"; pzTo="$5"; pzFiles="$6"; pzReplyTo="$7" ( echo "From: $pzFrom\nTo: $pzTo\nSubject: $pzTitle${pzReplyTo:+\nReply-To: $pzReplyTo}" ] && echo... (1 Reply)
Discussion started by: ankit.mca.aaidu
1 Replies

9. Shell Programming and Scripting

Need code for updating second record to first record in shell scripting

Hi,, I have requirement that i need to get DISTINCT values from a table and if there are two records i need to update it to one record and then need to submit INSERT statements by using the updated value as a parameter. Here is the example follows.. SELECT DISTINCT ID FROM OFFER_GROUP WHERE... (1 Reply)
Discussion started by: Samah
1 Replies

10. Shell Programming and Scripting

Delete all CONSECUTIVE text lines from file shell scripting

Hi I have a text file like below. THe content of the text will vary. Entire text file have four consecutive lines followed with blank line. I want to delete the occurrence of the two consicutive lines in the text file. I don't have pattern to match and delete. Just i need to delete all... (5 Replies)
Discussion started by: RJSKR28
5 Replies
WIDGET(1p)						       perl/Tk Documentation							WIDGET(1p)

NAME
widget - Demonstration of Perl/Tk widgets SYNOPSYS
widget [ directory ] DESCRIPTION
This script demonstrates the various widgets provided by Tk, along with many of the features of the Tk toolkit. This file only contains code to generate the main window for the application, which invokes individual demonstrations. The code for the actual demonstrations is contained in separate ".pl" files in the "widget_lib" directory, which are autoloaded by this script as needed. widget looks in the directory specified on the command line to load user contributed demonstrations. If no directory name is specified when widget is invoked and the environment variable WIDTRIB is defined then demonstrations are loaded from the WIDTRIB directory. If WIDTRIB is undefined then widget defaults to the released user contributed directory, "widtrib". History # # Stephen O. Lidie, LUCC, 96/03/11. lusol@Lehigh.EDU # Stephen O. Lidie, LUCC, 97/01/01. lusol@Lehigh.EDU # Stephen O. Lidie, LUCC, 97/02/11. lusol@Lehigh.EDU # Stephen O. Lidie, LUCC, 97/06/07. lusol@Lehigh.EDU # Update for Tk402.00x. Total revamp: WidgetDemo, Scrolled, released # composites, -menuitems, qw//, etcetera. Perl 5.004 required. # Stephen O. Lidie, LUCC, 98/03/10. lusol@Lehigh.EDU # Update for Tk8. # Stephen O. Lidie, LUCC, 98/06/26. Stephen.O.Lidie@Lehigh.EDU # Add Common Dialogs for Tk800.007. # Stephen.O.Lidie@Lehigh.EDU, 1999/11/29, Lehigh University. # Demo some "dash patch" changes. # Stephen.O.Lidie@Lehigh.EDU, 2000/01/11, Lehigh University. # Update menubar to Tk 8, fix color palette Menubutton demo. # Stephen.O.Lidie@Lehigh.EDU, 2000/07/06, Lehigh University. # Remove inswt() from widget and styles.pl to show the proper Perl/Tk # idiom for inserting Text tags. Various and sundry cleanups. # sol0@lehigh.edu, 2003/07/29, Lehigh University Computing Center. # Update for Tk 8.4.4. AUTHOR
Steve Lidie <sol0@Lehigh.EDU> Tk804.03 2011-06-19 WIDGET(1p)
All times are GMT -4. The time now is 01:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy