08-06-2008
There might be other more clever solutions, but this one works.
[CODE]
Tsunami xml # cat xml
<img width="470" height="321" alt="A Remote COM Object" src="dicwiz02.gif"><bookmark name="f004"/></img>
<img src="diwiz01.gif" width="576" height="254" alt="Out-of-process and In-process COM Objects"><bookmark name="f003"/></img>
Tsunami xml # perl -ne 'print "$1 $2\n" if /<img.*?(?:src|alt)=\"(.*?)\".*?(?:alt|src)=\"(.*?)\".*?<\/img>/;' xml
A Remote COM Object dicwiz02.gif
diwiz01.gif Out-of-process and In-process COM Objects
Tsunami xml #
[CODE]
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Jean
I require your help in writing a shell script. Iam zero in Unix programming. I have a large file about 400 MB of data, which contains about 50000 XML messages seperated by a Tab, I think. I need to extract only 4 values from each XML message and write it onto a new file. Please help me... (2 Replies)
Discussion started by: pk_eee
2 Replies
2. Shell Programming and Scripting
Hi All,
I am new to Unix I need a KSH script to get the values from XML file to write to a temp file.
Like the requirement is from the below TAG
<MAPPING DESCRIPTION ="Test Mapping" ISVALID ="YES" NAME ="m_test_xml" OBJECTVERSION ="1" VERSIONNUMBER ="1">
I need the MAPPING DESCRIPTION... (3 Replies)
Discussion started by: perlamohan
3 Replies
3. Programming
i have an input file of XML type with data like
<nx-charging:additional-parameter name="NX_INTERNATIONALIZED_CLID" value="919427960829"/><nx-charging:finalStatus>RESPONSE , Not/Applicable , OK</nx-charging:finalStatus></nx-charging:process>
i want to extract data such that i get the output... (3 Replies)
Discussion started by: junaid.nehvi
3 Replies
4. UNIX for Dummies Questions & Answers
Hello People,
I have an xml file from which I need to extract the values of the parameters using UNIX shell commands.
Ex : Input is like :
<Name>Roger</Name>
or
<Address>MI</Address>
I need the output as just :
Roger
or
MI
with the tags removed.
Please help. (1 Reply)
Discussion started by: sushant172
1 Replies
5. Shell Programming and Scripting
Greetings,
I am very new to the UNIX shell scripting and would like to learn. However, I am currently stuck on how to process the below sample of code from an XML file using UNIX comands:
<ATTRIBUTE NAME="Memory" VALUE="512MB"/>
<ATTRIBUTE NAME="CPU Speed" VALUE="3.0GHz"/>
<ATTRIBUTE... (5 Replies)
Discussion started by: JesterMania
5 Replies
6. Shell Programming and Scripting
Hi All,
Please help me out in resolving this..
<secondTag enabled='true' processName='test1' pidFile='/tmp/test1.pid' />
From the above tag, I'm trying to retrieve the value of enabled and pidFile attributes by means of processName attribute.
Would be thankful in resolving this..... (5 Replies)
Discussion started by: mjavalkar
5 Replies
7. Shell Programming and Scripting
Find out values between xml tag
.......
ABC><name></ABC><xyz>test</xyz>..here some other tag... <ABC><NUMBER></ABC><xyz>12345</xyz>....
.......
I want to take between bewtween ABC><NUMBER></ABC><xyz> to </xyz> that is 12345 (3 Replies)
Discussion started by: Jairaj
3 Replies
8. Shell Programming and Scripting
I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help
File:
<xml><object1>house</object1><object2>child</object2>... (9 Replies)
Discussion started by: srkmish
9 Replies
9. Shell Programming and Scripting
Hi,
My requirement is something like this,
I have a xml file that contains some tags and nested tags,
<n:tag_name1>
<n:sub_tag1>val1</n:sub_tag1>
<n:sub_tag2>val2</n:sub_tag2>
</n:tag_name1>
<n:tag_name2>
<n:sub_tag1>value</n:sub_tag1>
... (6 Replies)
Discussion started by: Little
6 Replies
10. Shell Programming and Scripting
Hi Forum.
I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script.
Any feedback will be greatly appreciated.
... (19 Replies)
Discussion started by: pchang
19 Replies
LEARN ABOUT SUNOS
xml::parser::style::stream
Parser::Style::Stream(3) User Contributed Perl Documentation Parser::Style::Stream(3)
NAME
XML::Parser::Style::Stream - Stream style for XML::Parser
SYNOPSIS
use XML::Parser;
my $p = XML::Parser->new(Style => 'Stream', Pkg => 'MySubs');
$p->parsefile('foo.xml');
{
package MySubs;
sub StartTag {
my ($e, $name) = @_;
# do something with start tags
}
sub EndTag {
my ($e, $name) = @_;
# do something with end tags
}
sub Characters {
my ($e, $data) = @_;
# do something with text nodes
}
}
DESCRIPTION
This style uses the Pkg option to find subs in a given package to call for each event. If none of the subs that this style looks for is
there, then the effect of parsing with this style is to print a canonical copy of the document without comments or declarations. All the
subs receive as their 1st parameter the Expat instance for the document they're parsing.
It looks for the following routines:
* StartDocument
Called at the start of the parse .
* StartTag
Called for every start tag with a second parameter of the element type. The $_ variable will contain a copy of the tag and the %_ vari-
able will contain attribute values supplied for that element.
* EndTag
Called for every end tag with a second parameter of the element type. The $_ variable will contain a copy of the end tag.
* Text
Called just before start or end tags with accumulated non-markup text in the $_ variable.
* PI
Called for processing instructions. The $_ variable will contain a copy of the PI and the target and data are sent as 2nd and 3rd
parameters respectively.
* EndDocument
Called at conclusion of the parse.
perl v5.8.4 2003-08-18 Parser::Style::Stream(3)