Sponsored Content
Top Forums Shell Programming and Scripting extract specific data from xml format file. Post 302158413 by 60doses on Tuesday 15th of January 2008 07:26:54 AM
Old 01-15-2008
Yea.. just got the stuff in the morning, and I only have merely 12hours before submitting the report. Gah.

Thanks for your reply, but your code is nice enough to extract out the time, and I won't be needing all. Need it to match these 2 cases:

1) LogEvent ID ="Timer Start"
2) <![CDATA[send messages

What if I just want to extract the whole LogEvent ID="Timer Start"?

From <LogEvent ID="Timer Start"> to </LogEvent>.
 

10 More Discussions You Might Find Interesting

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

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

3. Shell Programming and Scripting

How to Append the specific data to the xml file

I have an xml file data as shown below: <impl name="Nortel" is-enabled="true"> <package-mappings> <const-mapping target-state="EndPoint" target-param="cfCNDSubscribed" constant-value="true"/> <const-mapping... (2 Replies)
Discussion started by: ravi_rn
2 Replies

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

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

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

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

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

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

10. Shell Programming and Scripting

Extract the specific tags in a XML file

Hello Shell Gurus, I have a requirement to get the specific tags from a XML file. Here is my code snippet <jdbc-system-resource> <name>SDPData Source</name> <target>AdminServer,osb_server1,soa_server1</target> ... (30 Replies)
Discussion started by: Siv51427882
30 Replies
Benchmark::Timer(3pm)					User Contributed Perl Documentation				     Benchmark::Timer(3pm)

NAME
Benchmark::Timer - Benchmarking with statistical confidence SYNOPSIS
# Non-statistical usage use Benchmark::Timer; $t = Benchmark::Timer->new(skip => 1); for(1 .. 1000) { $t->start('tag'); &long_running_operation(); $t->stop('tag'); } print $t->report; # -------------------------------------------------------------------- # Statistical usage use Benchmark::Timer; $t = Benchmark::Timer->new(skip => 1, confidence => 97.5, error => 2); while($t->need_more_samples('tag')) { $t->start('tag'); &long_running_operation(); $t->stop('tag'); } print $t->report; DESCRIPTION
The Benchmark::Timer class allows you to time portions of code conveniently, as well as benchmark code by allowing timings of repeated trials. It is perfect for when you need more precise information about the running time of portions of your code than the Benchmark module will give you, but don't want to go all out and profile your code. The methodology is simple; create a Benchmark::Timer object, and wrap portions of code that you want to benchmark with "start()" and "stop()" method calls. You can supply a tag to those methods if you plan to time multiple portions of code. If you provide error and confidence values, you can also use "need_more_samples()" to determine, statistically, whether you need to collect more data. After you have run your code, you can obtain information about the running time by calling the "results()" method, or get a descriptive benchmark report by calling "report()". If you run your code over multiple trials, the average time is reported. This is wonderful for benchmarking time-critical portions of code in a rigorous way. You can also optionally choose to skip any number of initial trials to cut down on initial case irregularities. METHODS
In all of the following methods, $tag refers to the user-supplied name of the code being timed. Unless otherwise specified, $tag defaults to the tag of the last call to "start()", or "_default" if "start()" was not previously called with a tag. $t = Benchmark::Timer->new( [options] ); Constructor for the Benchmark::Timer object; returns a reference to a timer object. Takes the following named arguments: skip The number of trials (if any) to skip before recording timing information. minimum The minimum number of trials to run. error A percentage between 0 and 100 which indicates how much error you are willing to tolerate in the average time measured by the benchmark. For example, a value of 1 means that you want the reported average time to be within 1% of the real average time. "need_more_samples()" will use this value to determine when it is okay to stop collecting data. If you specify an error you must also specify a confidence. confidence A percentage between 0 and 100 which indicates how confident you want to be in the error measured by the benchmark. For example, a value of 97.5 means that you want to be 97.5% confident that the real average time is within the error margin you have specified. "need_more_samples()" will use this value to compute the estimated error for the collected data, so that it can determine when it is okay to stop. If you specify a confidence you must also specify an error. $t->reset; Reset the timer object to the pristine state it started in. Erase all memory of tags and any previously accumulated timings. Returns a reference to the timer object. It takes the same arguments the constructor takes. $t->start($tag); Record the current time so that when "stop()" is called, we can calculate an elapsed time. $t->stop($tag); Record timing information. If $tag is supplied, it must correspond to one given to a previously called "start()" call. It returns the elapsed time in milliseconds. "stop()" croaks if the timer gets out of sync (e.g. the number of "start()"s does not match the number of "stop()"s.) $t->need_more_samples($tag); Compute the estimated error in the average of the data collected thus far, and return true if that error exceeds the user-specified error. If a $tag is supplied, it must correspond to one given to a previously called "start()" call. This routine assumes that the data are normally distributed. $t->report($tag); Returns a string containing a simple report on the collected timings for $tag. This report contains the number of trials run, the total time taken, and, if more than one trial was run, the average time needed to run one trial and error information. "report()" will complain (via a warning) if a tag is still active. $t->reports; In a scalar context, returns a string containing a simple report on the collected timings for all tags. The report is a concatenation of the individual tag reports, in the original tag order. In an list context, returns a hash keyed by tag and containing reports for each tag. The return value is actually an array, so that the original tag order is preserved if you assign to an array instead of a hash. "reports()" will complain (via a warning) if a tag is still active. $t->result($tag); Return the time it took for $tag to elapse, or the mean time it took for $tag to elapse once, if $tag was used to time code more than once. "result()" will complain (via a warning) if a tag is still active. $t->results; Returns the timing data as a hash keyed on tags where each value is the time it took to run that code, or the average time it took, if that code ran more than once. In scalar context it returns a reference to that hash. The return value is actually an array, so that the original tag order is preserved if you assign to an array instead of a hash. $t->data($tag), $t->data; These methods are useful if you want to recover the full internal timing data to roll your own reports. If called with a $tag, returns the raw timing data for that $tag as an array (or a reference to an array if called in scalar context). This is useful for feeding to something like the Statistics::Descriptive package. If called with no arguments, returns the raw timing data as a hash keyed on tags, where the values of the hash are lists of timings for that code. In scalar context, it returns a reference to that hash. As with "results()", the data is internally represented as an array so you can recover the original tag order by assigning to an array instead of a hash. BUGS
Benchmarking is an inherently futile activity, fraught with uncertainty not dissimilar to that experienced in quantum mechanics. But things are a little better if you apply statistics. LICENSE
This code is distributed under the GNU General Public License (GPL). See the file LICENSE in the distribution, http://www.opensource.org/gpl-license.html, and http://www.opensource.org/. AUTHOR
The original code (written before April 20, 2001) was written by Andrew Ho <andrew@zeuscat.com>, and is copyright (c) 2000-2001 Andrew Ho. Versions up to 0.5 are distributed under the same terms as Perl. Maintenance of this module is now being done by David Coppit <david@coppit.org>. SEE ALSO
Benchmark, Time::HiRes, Time::Stopwatch, Statistics::Descriptive perl v5.10.1 2009-12-03 Benchmark::Timer(3pm)
All times are GMT -4. The time now is 04:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy