02-05-2008
Shell script for text extraction from a file
Hi All,
I am new to Shell Scripting.
I have a file consisting of XML messages.Each message is associated with a timestamp value(it is not a xml field).I need to extract\copy all messages in a particular time interval and put in another new file using Shell Scripting. My XML looks like this.
2008-01-27 00:05:00 (2008-01-27 00:05:00.055000000Z): message={Data="<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Header>
....
....
</Header>
<Body>
....
....
</Body>
</Envelope>"
2008-01-27 00:05:12 (2008-01-27 00:05:12.055000000Z): message={Data="<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Header>
....
....
</Header>
<Body>
....
....
</Body>
</Envelope>"
Any code/example is welcome.
Thanks,
Vignesh.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file of the following format.
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user... (5 Replies)
Discussion started by: nua7
5 Replies
2. UNIX for Advanced & Expert Users
hi everybody,
i have a file, in it I need to extract some data that follows a particular pattern..
For example: my file contains like
now running Speak225
sep 22 mon 16:34:05 2008
--------------------------------
... (4 Replies)
Discussion started by: mohkris
4 Replies
3. UNIX for Dummies Questions & Answers
The following script code works great for extracting 'postmaster' from a line of text stored in a variable named string:
string="PenaltyError:=554 5.7.1 Error, send your mail to postmaster@LOCALDOMAIN"
stuff=$( echo $string | cut -d@ -f1 | awk '{ print $NF }' )
echo $stuff
However, I need to be... (9 Replies)
Discussion started by: cleanden
9 Replies
4. Shell Programming and Scripting
Hi all,
I am beginner in UNIX...I want to use unix shell script to create text.file...I know how to use using by command...can anybody tell me for the script?
Thanks
i changed the threads title from "tex file" to "text file", because "tex" would probably be misunderstood as reference to... (4 Replies)
Discussion started by: mastercar
4 Replies
5. Infrastructure Monitoring
Hello Users,
I am new to unix. I have a requirement to extract the string in the folder with files names XXXX.sev.xxxxx.lookup (There are some more files which I am not interested in like xxxxx.include.xxx.lookup).
1) I am looking for the file with the name "sev" ending with "lookup"
... (11 Replies)
Discussion started by: reachravi70
11 Replies
6. Shell Programming and Scripting
This is the ldf file
dn: sdcsmsisdn=1000000049,sdcsDatabase=subscriberCache,dc=example,dc=com
objectClass: sdcsSubscriber
objectClass: top
postalCode: 29600
sdcsServiceLevel: 10
sdcsCustomerType: 14
givenName: Adelia
sdcsBlackListAll: FALSE
sdcsOwnerType: T-Mobile
sn: Actionteam... (1 Reply)
Discussion started by: LinuxFriend
1 Replies
7. Shell Programming and Scripting
Suppose im in a directory A. which has sub-directories x/y/z m/n/p etc. Iam only considered with those which have a file netl.oa at the lowermost level. So i used the find command which gives me a list in the form
./abc/def/ghi/jkl/netl.oa
and so on
Now i want the names abc def jkl and ghi. My... (3 Replies)
Discussion started by: sid.verycool
3 Replies
8. UNIX for Dummies Questions & Answers
sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies
9. Shell Programming and Scripting
Hi Everyone,
I want your help to write a script which will take text file as input and on the basis of delimiter ":"script will create excel sheet.
Example input:
IpAdress:InstanceName:Port:ServerName
10.255.255.1:abc:2232:xyz_abc
Output should be an excel sheet like below:
Column... (8 Replies)
Discussion started by: akabhinav18
8 Replies
LEARN ABOUT DEBIAN
xml::sax::expat
Expat(3pm) User Contributed Perl Documentation Expat(3pm)
NAME
XML::SAX::Expat - SAX2 Driver for Expat (XML::Parser)
SYNOPSIS
use XML::SAX::Expat;
use XML::SAX::MyFooHandler;
my $h = XML::SAX::MyFooHandler->new;
my $p = XML::SAX::Expat->new(Handler => $h);
$p->parse_file('/path/to/foo.xml');
DESCRIPTION
This is an implementation of a SAX2 driver sitting on top of Expat (XML::Parser) which Ken MacLeod posted to perl-xml and which I have
updated.
It is still incomplete, though most of the basic SAX2 events should be available. The SAX2 spec is currently available from
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/perl-xml/libxml-perl/doc/sax-2.0.html?rev=HEAD&content-type=text/html
A more friendly URL as well as a PODification of the spec are in the works.
METHODS
The methods defined in this class correspond to those listed in the PerlSAX2 specification, available above.
FEATURES AND CAVEATS
supported_features
Returns:
* http://xml.org/sax/features/external-general-entities
* http://xml.org/sax/features/external-parameter-entities
* [ Features supported by ancestors ]
Turning one of the first two on also turns the other on (this maps to the XML::Parser ParseParamEnts option). This may be fixed in the
future, so don't rely on this behaviour.
MISSING PARTS
XML::Parser has no listed callbacks for the following events, which are therefore not presently generated (ways may be found in the
future):
* ignorable_whitespace
* skipped_entity
* start_entity / end_entity
* resolve_entity
Ways of signalling them are welcome. In addition to those, set_document_locator is not yet called.
TODO
- reuse Ken's tests and add more
AUTHOR
Robin Berjon; stolen from Ken Macleod, ken@bitsko.slc.ut.us, and with suggestions and feedback from perl-xml. Currently maintained by
Bjoern Hoehrmann <http://bjoern.hoehrmann.de/>.
COPYRIGHT AND LICENSE
Copyright (c) 2001-2008 Robin Berjon. All rights reserved. This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
SEE ALSO
XML::Parser::PerlSAX
perl v5.12.4 2008-06-30 Expat(3pm)