Sponsored Content
Top Forums Shell Programming and Scripting Extract the specific tags in a XML file Post 303005584 by Scrutinizer on Friday 20th of October 2017 02:15:01 AM
Old 10-20-2017
Hi, try:

Code:
awk '
  $1~/jdbc-data-source / {
    split($1,F,/"/)
    name=F[2]
  } 
  {
    P[$1]=$2
  }
  END {
    print name, P["url"], P["driver-name"], P["value"], P["password-encrypted"], P["jndi-name"]
  } 
' RS=\< FS=\> OFS='\n' file

Output:
Code:
http://xmlns.oracle.com/weblogic/jdbc-data-source
jdbc:oracle:thin:@10.137.181.188:1521/soa12cdb
oracle.jdbc.xa.client.OracleXADataSource
DEV_SOAINFRA
{AES}xxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
jdbc/SOADBDataSource



--
On Solaris use /usr/xpg4/bin/awk

Last edited by Scrutinizer; 10-20-2017 at 03:39 AM..
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract specific data from xml format file.

Hi, I need to extract the start time value (bold, red font) under the '<LogEvent ID="Timer Start">' tag (black bold) from a file with the following pattern. There are other LogEventIDs listed in the file as well, making it harder for me to extract out the specific start time that I need. . .... (7 Replies)
Discussion started by: 60doses
7 Replies

2. UNIX for Dummies Questions & Answers

Extract a specific number from an XML file based on the start and end tags

Hello People, I have the following contents in an XML file ........... ........... .......... ........... <Details = "Sample Details"> <Name>Bob</Name> <Age>34</Age> <Address>CA</Address> <ContactNumber>1234</ContactNumber> </Details> ........... ............. .............. (4 Replies)
Discussion started by: sushant172
4 Replies

3. Shell Programming and Scripting

bash extract all occurences delimited from <name> and </name> tags from an xml file

I need to extract all text delimited from <name> and </name> tags from an xml file, but not only first occurence. I need to extract all occurences. I've tried with this command: awk -F"<name>|</name>" 'NF>2{print $2}' but it give only first occurence. How can i modify it? (18 Replies)
Discussion started by: ingalex
18 Replies

4. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

5. Shell Programming and Scripting

Shell script to extract data in repeating tags from xml

Hi, I am new to shell scripting. I need to extract data between repeating tags from an xml file and store the data in an array to process it further. <ns1:root xmlns:ns1="http://example.com/config"> <ns1:interface>in1</ns1:interface> <ns1:operation attribute1="true" attribute2="abd"... (2 Replies)
Discussion started by: sailendra
2 Replies

6. Shell Programming and Scripting

Extract a particular xml only from an xml jar file

Hi..need help on how to extract a particular xml file only from an xml jar file... thanks! (2 Replies)
Discussion started by: qwerty000
2 Replies

7. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

8. Shell Programming and Scripting

Parse xml in shell script and extract records with specific condition

Hi I have xml file with multiple records and would like to extract records from xml with specific condition if specific tag is present extract entire row otherwise skip . <logentry revision="21510"> <author>mantest</author> <date>2015-02-27</date> <QC_ID>334566</QC_ID>... (12 Replies)
Discussion started by: madankumar.t@hp
12 Replies

9. UNIX for Beginners Questions & Answers

How can we extract specific elements from XML?

Hi, I have a requirement to extract specific element value dynamically from XML message. Here is the sample message: <File> <List> <main> <dir>doc/store834/archive</dir> <count>5</count> </main> <main> <dir>doc/store834/extract</dir> <count>6</count> </main> <main> ... (3 Replies)
Discussion started by: renukeswar
3 Replies

10. UNIX for Beginners Questions & Answers

How to pull multiple XML tags from the same XML file in Shell.?

I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies
asadmin-get(1AS)						   User Commands						  asadmin-get(1AS)

NAME
asadmin-get, get - gets the values of the monitorable or configurable attributes SYNOPSIS
get --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] [--monitor=false] dotted_attribute_name Gets the values of attributes. If the --monitor option is set to true, the monitorable attributes are returned. If the --monitor option is set to false, the configurable attribute values are returned. On Solaris, quotes are needed when executing commands with * as the option value or operand. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. --monitor defaults to false; if set to false, the configurable attribute values are returned. If set to true, the monitorable attribute values are returned. OPERANDS
attributename attribute name in the dotted notation. Example 1: Using get asadmin> get --user admin --password adminadmin --host localhost --port 4848 "server.resources.jdbc-resource.jdbc/PointBase.*" server.resources.jdbc-resource.jdbc/PointBase.description=<null> server.resources.jdbc-resource.jdbc/PointBase.enabled=true server.resources.jdbc-resource.jdbc/PointBase.jndi-name=jdbc/PointBase server.resources.jdbc-resource.jdbc/PointBase.object-type=user server.resources.jdbc-resource.jdbc/PointBase.pool-name=PointBasePool EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-set(1AS), asadmin-list(1AS) J2EE 1.4 SDK March 2004 asadmin-get(1AS)
All times are GMT -4. The time now is 03:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy