Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Delete a record in a xml file using shell scripting Post 302657053 by sdesstp on Saturday 16th of June 2012 01:46:55 AM
Old 06-16-2012
Delete a record in a xml file using shell scripting

find pattern, delete line with pattern and 3 lines above and 8 lines below the pattern. The pattern is "isup". The entire record with starting tag <record> and ending tag </record> containing the pattern is to be deleted and the rest to be retained.

Code:
<record>
    <signallingstandard>ITU-N</signallingstandard>
    <linkid>16068</linkid>
    <si>sccp</si>
    <mtp>
      <opc>3020</opc>
      <dpc>8034</dpc>
    </mtp>
    <sccp>
    </sccp>
    <map>
      <opcode>36</opcode>
    </map>
    <msucount>1</msucount>
    <octcount>83</octcount>
  </record>

  <record>
    <signallingstandard>ITU-N</signallingstandard>
    <linkid>37</linkid>
    <si>isup</si>
    <mtp>
      <opc>8469</opc>
      <dpc>10336</dpc>
    </mtp>
    <msucount>168</msucount>
    <octcount>3069</octcount>
  </record>

<record>
    <signallingstandard>ITU-N</signallingstandard>
    <linkid>46</linkid>
    <si>sccp</si>
    <mtp>
      <opc>287</opc>
      <dpc>24</dpc>
    </mtp>
    <sccp>
      <cgpadigits>966540142007</cgpadigits>
      <cdpadigits>919434099997</cdpadigits>
    </sccp>
    <msucount>1</msucount>
    <octcount>53</octcount>
  </record>


Last edited by pludi; 06-16-2012 at 06:07 PM.. Reason: code tags
 

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
FC-PATTERN(1)                                                                                                                        FC-PATTERN(1)

NAME
fc-pattern - parse and show pattern SYNOPSIS
fc-pattern [ -cdVh ] [ --config ] [ --default ] [ -f format | --format format ] [ --version ] [ --help ] [ pattern [ element ... ] ] DESCRIPTION
fc-pattern parses pattern (empty pattern by default) and shows the parsed result. If --config is given, config substitution is performed on the pattern before being displayed. If --default is given, default substitution is performed on the pattern before being displayed. If any elements are specified, only those are printed. OPTIONS
This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. -c --config Perform config substitution on pattern. -d --default Perform default substitution on pattern. -f --format format Format output according to the format specifier format. -V --version Show version of the program and exit. -h --help Show summary of options. pattern Parses and displays pattern (uses empty pattern by default). element If set, the element property is displayed for parsed pattern. SEE ALSO
FcNameParse(3) FcConfigSubstitute(3) FcDefaultSubstitute(3) FcPatternPrint(3) FcPatternFormat(3) fc-cat(1) fc-cache(1) fc-list(1) fc- match(1) fc-query(1) fc-scan(1) The fontconfig user's guide, in HTML format: /usr/share/doc/fontconfig/fontconfig-user.html. AUTHOR
This manual page was updated by Behdad Esfahbod <behdad@behdad.org>. 16 April 2012 FC-PATTERN(1)
All times are GMT -4. The time now is 12:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy