Sponsored Content
Top Forums Shell Programming and Scripting How can I extract XML block around matching search string? Post 302966506 by Aia on Friday 12th of February 2016 10:50:03 PM
Old 02-12-2016
Quote:
Originally Posted by kchinnam
Aia,, your solution worked when I removed prefix spaces with tag <application>. I tried below to allow spaces, its not working..
[...]
Can we tell it to ignore spaces before and after </application> tag?
Is your posted data not a true representation of the real file?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search for string in a file and extract another string to a variable

Hi, guys. I have one question: I need to search for a string in a file, and then extract another string from the file and assign it to a variable. For example: the contents of the file (group) is below: ... ftp:x:23: mail:x:34 ... testing:x:2001 sales:x:2002 development:x:2003 ...... (6 Replies)
Discussion started by: daikeyang
6 Replies

2. Shell Programming and Scripting

Extract selective block from XML file

Hi, There's an xml file produced from a front-end tool as shown below: <INPUT DATABASE ="ORACLE" DBNAME ="UNIX" NAME ="FACT_TABLE" OWNERNAME ="DIPS"> <INPUTFIELD DATATYPE ="double" DEFAULTVALUE ="" DESCRIPTION ="" NAME ="STORE_KEY" PICTURETEXT ="" PORTTYPE ="INPUT" PRECISION ="15" SCALE... (6 Replies)
Discussion started by: dips_ag
6 Replies

3. UNIX for Dummies Questions & Answers

Search and extract matching patterns

%%%%% (9 Replies)
Discussion started by: lucasvs
9 Replies

4. Shell Programming and Scripting

XML - Split And Extract String between Chars

Hi, I am trying to read the records from file and split into multiple files. SourceFile.txt <?xml version="1.0" encoding="UTF-8"?>... (2 Replies)
Discussion started by: unme
2 Replies

5. Shell Programming and Scripting

Extract string from XML

Hi, I wish to grep for the first instance of <listen-address> value between the first <server></server> tag in an xml file. Sample xml: ......... <timeout-seconds>1500</timeout-seconds> </jta> <server> <name>Adminserver_DEV</name> ... (9 Replies)
Discussion started by: mohtashims
9 Replies

6. Shell Programming and Scripting

To extract a string between two words in XML file

i need to extract the string between two tags, input file is <PersonInfoShipTo AddressID="446311709" AddressLine1="" AddressLine2="" AddressLine3="" AddressLine4="" AddressLine5="" AddressLine6="" AlternateEmailID="" Beeper="" City="" Company="" Country="" DayFaxNo="" DayPhone="" Department=""... (5 Replies)
Discussion started by: Padmanabhan
5 Replies

7. Shell Programming and Scripting

Extract First and matching word from string in UNIX

Thank you (2 Replies)
Discussion started by: Pratik Majithia
2 Replies

8. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

9. Shell Programming and Scripting

Extract all text between the same matching string from a given column

Hello All, I have an input sample data like below (In actual I have many columns and few million rows). Column1,Column2 4,2 1,5 Hello,4 1,4 Hello,2 3,5 Hello,8 4,5 Need the output (using awk and/or sed preferably) like below. Here I need all the lines between 2 matching... (1 Reply)
Discussion started by: ks_reddy
1 Replies

10. UNIX for Beginners Questions & Answers

Extract XML block when value is matched (Shell script)

Hi everyone, So i'm struggling with an xml (log file) where we get information about some devices, so the logfile is filled with multiple "blocks" like that. Based on the <devId> i want to extract this part of the xml file. If possible I want it to have an script for this, cause we'll use... (5 Replies)
Discussion started by: Pouky
5 Replies
Exacct::Catalog(3PERL)					      Perl Library Functions					    Exacct::Catalog(3PERL)

NAME
Exacct::Catalog - exacct catalog tag manipulation SYNOPSIS
use Sun::Solaris::Exacct::Catalog qw(:ALL); my $ea_cat = Sun::Solaris::Exacct::Catalog->new( &EXT_UINT64 | &EXC_DEFAULT | &EXD_PROC_PID); DESCRIPTION
This class provides a wrapper around the 32-bit integer used as a catalog tag. The catalog tag is represented as a Perl object blessed into the Sun::Solaris::Exacct::Catalog class so that methods can be used to manipulate fields in a catalog tag. Constants All the EXT_*, EXC_*, and EXD_* macros are provided as constants. Constants passed to the methods below can either be the integer value such as EXT_UINT8 or the string representation such as "EXT_UINT8". Functions None. Class methods register($cat_pfx, $catalog_id, $export, @idlist) This method is used to register application-defined libexacct(3LIB) catalogs with the exacct Perl library. See </usr/include/sys/exacct_catalog.h> for details of the catalog tag format. This method allows symbolic names and strings to be used for manipulating application-defined catalogs. The first two parameters define the catalog prefix and associated numeric catalog ID. If the $export parameter is true, the constants are exported into the caller's package. The final parameter is a list of (id, name) pairs that identify the required constants. The constants created by this method are formed by appending $cat_pfx and "_" to each name in the list, replacing any spaces with underscore characters and converting the resulting string to uppercase characters. The $catalog_name value is also created as a constant by prefixing it with EXC_ and converting it to uppercase characters. Its value becomes that of $catalog_id shifted left by 24 bits. For example, the following call: Sun::Solaris::Exacct::Catalog->ea_register("MYCAT", 0x01, 1, FIRST => 0x00000001, SECOND => 0x00000010); results in the definition of the following constants: EXC_MYCAT 0x01 << 24 MYCAT_FIRST 0x00000001 MYCAT_SECOND 0x00000010 Only the catalog ID value of 0x01 is available for application use (EXC_LOCAL). All other values are reserved. While it is possible to use values other than 0x01, they might conflict with future extensions to the libexacct file format. If any errors are detected during this method, a string is returned containing the appropriate error message. If the call is sucessful, undef is returned. new($integer) new($cat_obj) new($type, $catalog, $id) This method creates and returns a new Catalog object, which is a wrapper around a 32-bit integer catalog tag. Three possible argument lists can be given. The first variant is to pass an integer formed by bitwise-inclusive OR of the appropriate EX[TCD]_* constants. The second variant is to pass an existing Catalog object that will be copied. The final variant is to pass in the type, catalog and ID fields as separate values. Each of these values can be either an appropriate integer constant or the string representation of the con- stant. Object methods value() This method allows the value of the catalog tag to be queried. In a scalar context it returns the 32-bit integer repre- senting the tag. In a list context it returns a (type, catalog, id) triplet, where each member of the triplet is a dual- typed scalar. type() This method returns the type field of the catalog tag as a dual-typed scalar. catalog() This method returns the catalog field of the catalog tag as a dual-typed scalar. id() This method returns the id field of the catalog tag as a dual-typed scalar. type_str() These methods return string representations of the appropriate value. These methods can be used for textual output of the catalog_str() various catalog fields. The string representations of the constants are formed by removing the EXT_, EXC_, or EXD_ prefix, id_str() replacing any underscore characters with spaces, and converting the remaining string to lowercase characters. Exports By default nothing is exported from this module. The following tags can be used to selectively import constants and functions defined in this module: :CONSTANTS EXT_*, EXC_*, and EXD_* :ALL :CONSTANTS ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpl5u | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
Exacct(3PERL), Exacct::File(3PERL), Exacct::Object(3PERL), Exacct::Object::Group(3PERL), Exacct::Object::Item(3PERL), libexacct(3LIB), attributes(5) SunOS 5.11 1 Dec 2002 Exacct::Catalog(3PERL)
All times are GMT -4. The time now is 06:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy