Sponsored Content
Top Forums Shell Programming and Scripting How to extract text from xml file Post 302134582 by ghostdog74 on Saturday 1st of September 2007 01:53:30 AM
Old 09-01-2007
Code:
awk '/VAL10="0">/ {	  
	  match($0,"VAL10=\"0\">")
	  v1start=RSTART
	  match($0,"</VAL>")
	  v2start=RSTART
	  print substr($0,v1start,v2start)
	}
' "file"

output:
Code:
# ./test.sh
VAL10="0">$400<BR>$400</VAL>
VAL10="0">XPOB 556-501<BR>XPOB 556-502</VAL>
VAL10="0">6/2-8/4 <BR>6/4-7/11*</VAL>
VAL10="0">S<BR>MW</VAL>
VAL10="0">This 40-hour course expands upon the topics covered in the Basic HVAC Maintenance course.<EM>Prerequisite: Basic Heating and Air Conditioning Equipment Maintenance course or instructor approval required prior to registering.</EM> Books not included</VAL>
VAL10="0">M<BR>M</VAL>
VAL10="0">*No class&nbsp;7/2-4</VAL>
VAL10="0">8 a.m.-noon<BR>8 a.m.-noon</VAL>

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract a number within an xml file

Hi Everyone, I have an sh script that I am working on and I have run into a little snag that I am hoping someone here can assist me with. I am using wget to retrieve an xml file from thetvdb.com. This part works ok but what I need to be able to do is extract the series ID # from the xml and put... (10 Replies)
Discussion started by: tret
10 Replies

2. Shell Programming and Scripting

Extract XML content from a file

310439 2012-01-11 03:44:42,291 INFO PutServlet:? - Content of the Message is:="1.0" encoding="UTF-8"?><ESP_SSIA_ACC_FEED> 310440 <BATCH_ID>12345678519</BATCH_ID> 310441 <UID>3498748823</UID> 310442 <FEED_TYPE>FULL</FEED_TYPE> 310443 <MART_NAME>SSIA_DM_TRANSACTIONS</MART_NAME> 310444... (11 Replies)
Discussion started by: arukuku
11 Replies

3. Shell Programming and Scripting

sed - extract text from xml file

hi, please help, i have an xml file, e.g: ... <tag> test text asdas="${abc}" xvxvbs:asdas${222}sdad asasa="${aa_bb_22}" </tag> ... i want to extract all "${...}", e.g: ${abc} ${222} ${aa_bb_22} thank you. (2 Replies)
Discussion started by: gioni
2 Replies

4. Shell Programming and Scripting

Extract values from an XML File

Hi, I need to capture all the attributes with delete next to it. The source XML file is attached. The output should contain something like this below: Attributes = legacyExchangeDN Action = Delete Username = Hero Joker Loginid = joker09 OU =... (4 Replies)
Discussion started by: prvnrk
4 Replies

5. Shell Programming and Scripting

Get extract text from xml file

Hi Collegue, i have a file say a.xml. it has contents <bpelFault><faultType>1</faultType><genericSystemFault xmlns=""><part name="payload"><v2:Fault... (10 Replies)
Discussion started by: Jewel
10 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 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

8. UNIX for Dummies Questions & Answers

Extract Element from XML file

<?xml version = '1.0' encoding =... (8 Replies)
Discussion started by: Siva SQL
8 Replies

9. Shell Programming and Scripting

Extract a value from an xml file

I have this XML file format and all in one line: Fri Dec 23 00:14:52 2016 Logged Message:689|<?xml version="1.0" encoding="UTF-8"?><PORT_RESPONSE><HEADER><ORIGINATOR>XMG</ORIGINATOR><DESTINAT... (16 Replies)
Discussion started by: mrn6430
16 Replies

10. Programming

How to write in other language in text/xml file by reading english text/xml file using C++?

Hello Team, I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file. Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
Discussion started by: SA_Palani
2 Replies
Statistics::Basic::Mean(3pm)				User Contributed Perl Documentation			      Statistics::Basic::Mean(3pm)

NAME
Statistics::Basic::Mean - find the mean of a list SYNOPSIS
Invoke it this way: my $avg = mean(1,2,3); Or this way: my $v1 = vector(1,2,3); my $avg = avg($v1); And then either query the values or print them like so: print "The mean of $v1: $avg "; my $mq = $avg->query; my $m0 = 0+$avg; Create a 20 point moving average like so: use Statistics::Basic qw(:all nofill); my $sth = $dbh->prepare("select col1 from data where something"); my $len = 20; my $avg = mean()->set_size($len); $sth->execute or die $dbh->errstr; $sth->bind_columns( my $val ) or die $dbh->errstr; while( $sth->fetch ) { $avg->insert( $val ); if( defined( my $m = $avg->query ) ) { print "Mean: $m "; } # This would also work: # print "Mean: $avg " if $avg->query_filled; } METHODS
new() The constructor takes a single array ref or a single Statistics::Basic::Vector as arguments. It returns a Statistics::Basic::Mean object. Note: normally you'd use the mean() constructor, rather than building these by hand using "new()". _OVB::import() This module also inherits all the overloads and methods from Statistics::Basic::_OneVectorBase. OVERLOADS
This object is overloaded. It tries to return an appropriate string for the calculation or the value of the computation in numeric context. In boolean context, this object is always true (even when empty). AUTHOR
Paul Miller "<jettero@cpan.org>" COPYRIGHT
Copyright 2012 Paul Miller -- Licensed under the LGPL SEE ALSO
perl(1), Statistics::Basic, Statistics::Basic::_OneVectorBase, Statistics::Basic::Vector perl v5.14.2 2012-01-23 Statistics::Basic::Mean(3pm)
All times are GMT -4. The time now is 09:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy