Sponsored Content
Top Forums Shell Programming and Scripting How to extract data from xml file using shell scripting? Post 302843131 by RavinderSingh13 on Monday 12th of August 2013 07:04:50 AM
Old 08-12-2013
Hello,

Could you please try as follows command. Also let us say we have a fike named test where all data is stored.

Note: Please use code tags it's a good practice, also refer the Forum rules for same.

Code:
$  awk '{ printf "%-30s %-20s %s\n", $1, $2, $3 }' test
TimeStamp="1234567890"         Data="t2u            A
TimeStamp="1234567890"         Data="t2uX           2
TimeStamp="1234567892"         Data="t2u            A
<TimeStamp="1234567892"        Data="t2u            X
TimeStamp="1234567894"         Data="t6u            X
TimeStamp="1374201903"         Data="t6u            A
$

$



Thanks,
R. Singh

Last edited by RavinderSingh13; 08-12-2013 at 08:26 AM.. Reason: a bit change
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract data from xml- shell script using awk

Hi, This is the xml file that i have. - <front-servlet platform="WAS4.0" request-retriever="SiteMinder-aware" configuration-rescan-interval="60000"> <concurrency-throttle maximum-concurrency="50" redirect-page="/jsp/defaulterror.jsp" /> - <loggers> <instrumentation... (5 Replies)
Discussion started by: nishana
5 Replies

2. 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

3. Shell Programming and Scripting

Help with shell script to extract data from XML file

Hello Scripting Gurus, I need help with extracting data from the XML file using shell script. The data is in a large XML and I need to extract the id values of all completedworkflows. Here is a sample of it. Input and output data is also in the attached text files. <wfregistry>... (5 Replies)
Discussion started by: yajaykumar
5 Replies

4. Shell Programming and Scripting

sed or awk to extract data from Xml file

Hi, I want to get data from Xml file by using sed or awk command. I want to get the following result : mon titre 1;Createur1;Dossier1 mon titre 1;Createur1;Dossier1 and save it in cvs file (fichier.cvs). FROM this Xml file (test.xml): <playlist version="1"> <trackList> <track>... (1 Reply)
Discussion started by: yeclota
1 Replies

5. Shell Programming and Scripting

Shell scripting to extract data from file

Hi, i want to fetch the data from the alert log file, for a particular time interval. Example : Alert log content : Thu Mar 18 08:47:36 2010 Completed: alter database open Thu Mar 18 19:13:38 2010 MMNL absent for 6390 secs; Foregrounds taking over Fri Mar 19 08:30:52 2010... (1 Reply)
Discussion started by: Pinki018
1 Replies

6. Shell Programming and Scripting

Data Extract from XML Log File

Please help me out to extract the Data from the XML Log files. So here is the data ERROR|2010-08-26 00:05:52,958|SERIAL_ID=128279996|ST=2010-08-2600:05:52|DEVICE=113.2.21.12:601|TYPE=TransactionLog... (9 Replies)
Discussion started by: raghunsi
9 Replies

7. 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

8. Shell Programming and Scripting

Extract data from XML file

Hi , I have input file as XML. following are input data #complex.xml <?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: mohan sharma
1 Replies

9. 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

10. Shell Programming and Scripting

Extract Data from XML file.

Hi Guys, I am in a need to extract data from a xml file. The XML file format is as below. <data jsxnamespace="propsbundle" locales=""> <locale> <!--Error messages starts--> <record jsxid="CHARPAIR001" jsxtext=" must be selected"></record> <record... (1 Reply)
Discussion started by: Showdown
1 Replies
DBIx::Class::TimeStamp(3pm)				User Contributed Perl Documentation			       DBIx::Class::TimeStamp(3pm)

NAME
DBIx::Class::TimeStamp - DBIx::Class extension to update and create date and time based fields DESCRIPTION
Works in conjunction with InflateColumn::DateTime to automatically set update and create date and time based fields in a table. SYNOPSIS
package My::Schema; __PACKAGE__->load_components(qw( TimeStamp ... Core )); __PACKAGE__->add_columns( id => { data_type => 'integer' }, t_created => { data_type => 'datetime', set_on_create => 1 }, t_updated => { data_type => 'datetime', set_on_create => 1, set_on_update => 1 }, ); Now, any update or create actions will update the specified columns with the current time, using the DateTime inflator. This is effectively trigger emulation to get consistent behavior across databases that either implement them poorly or not at all. METHODS
get_timestamp Returns a DateTime object pointing to now. Override this method if you have different time accounting functions, or want to do anything special. The date and time objects in the database are expected to be inflated. As such you can be pretty flexible with what you want to return here. AUTHOR
J. Shirley <jshirley@gmail.com> CONTRIBUTORS
Florian Ragwitz (Porting to DBIx::Class::DynamicDefault) LTJake/bricas COPYRIGHT &; LICENSE Copyright 2009 J. Shirley, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-09-05 DBIx::Class::TimeStamp(3pm)
All times are GMT -4. The time now is 06:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy