05-23-2009
Perl script parsing Help
Hi All,
I am looking for a parsing in perl script which will parse DJEČJI SVIJET. There is a unicode character above character C. How to parse the total DJEČJI SVIJET in perl.
Regards,
Harikrishna
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need help with a perl parsing script. I have some error logs on a windows machine that I need to parse from a text file, but I know nothing about perl. I usually run this bash script on my linux box and it does just what I need. How would I do the same thing with perl and port it to my windows... (2 Replies)
Discussion started by: cstovall
2 Replies
2. Shell Programming and Scripting
i have a HTML report file..its in attachment(a part of the whole report is attached..name "input html.doc").also its source is attached in "report source code.txt"
i just want to seperate the datas like in first line it should be..
NHTEST-3848498958-NHTEST-10.2-no-baloo a
and so on for whole... (3 Replies)
Discussion started by: avik1983
3 Replies
3. Shell Programming and Scripting
I have the following script:
#!/usr/bin/perl -w
@files = <*.csv>;
foreach $file (@files) {
open(FH, $file);
my @dt = split(/_|.csv/, $file);
while (<FH>) {
chomp;
print $dt . $dt . ",$_\n";
}
close(FH);
}
This script reads in all csv files in the current directory... (2 Replies)
Discussion started by: figaro
2 Replies
4. Shell Programming and Scripting
#! /usr/local/bin/perl -w
$ip = "$ARGV";
$rw = "$ARGV";
$snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw";
$snmpw = "/usr/local/bin/snmpwalk -Os -c $rw";
$syst=`$snmpg $ip system sysName sysObjectID`;
sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies
5. Programming
I have an extractfile (with fields delimited by pipes '|') and I want to prepend a counter based on the below requirements:
- The counter starts at 3.
- The counter increments only if the date (67th field of the extractfile) is different.
Below is what I started off with:
$cnt=2;... (3 Replies)
Discussion started by: ChicagoBlues
3 Replies
6. Shell Programming and Scripting
Hi Guys,
I have a large text file that is has a bunch of records. Each record starts with a header line that starts with the ">" character. Then there are several lines under that line that contain sequences of letters.
For example, a file might look like:
>TEXT ID=2L TEXT... (2 Replies)
Discussion started by: maverick.usb
2 Replies
7. Shell Programming and Scripting
I want to write a script that performs this type of behavior:
Example:
./Myscript.pl -a ARGUMENTRun code 'a'
./Myscript.pl -b ARGUMENT
Run code 'b'
Do I use a case statement, functions? I am new to perl, just a code template on how to achieve this would be great. (1 Reply)
Discussion started by: streetfighter2
1 Replies
8. Shell Programming and Scripting
in bash:
LIST=`cat $1`
for i in $LIST
do
...
done
how will i do this in perl ?
$1 is my first arguement. I'm a newbie in perl and will appreciate much your help guys ... (4 Replies)
Discussion started by: linuxgeek
4 Replies
9. UNIX for Advanced & Expert Users
Hello, I got a file like this.
5201
5202
5203
5204
1234
2345
3456
4567
6210
6220
6230
6240
The required output should be
5201 1234 6210 (9 Replies)
Discussion started by: suverman
9 Replies
10. UNIX for Beginners Questions & Answers
Hi,
I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies
LEARN ABOUT DEBIAN
xml::parser::lite
XML::Parser::Lite(3pm) User Contributed Perl Documentation XML::Parser::Lite(3pm)
NAME
XML::Parser::Lite - Lightweight regexp-based XML parser
SYNOPSIS
use XML::Parser::Lite;
$p1 = new XML::Parser::Lite;
$p1->setHandlers(
Start => sub { shift; print "start: @_
" },
Char => sub { shift; print "char: @_
" },
End => sub { shift; print "end: @_
" },
);
$p1->parse('<foo id="me">Hello World!</foo>');
$p2 = new XML::Parser::Lite
Handlers => {
Start => sub { shift; print "start: @_
" },
Char => sub { shift; print "char: @_
" },
End => sub { shift; print "end: @_
" },
}
;
$p2->parse('<foo id="me">Hello <bar>cruel</bar> World!</foo>');
DESCRIPTION
This Perl implements an XML parser with a interface similar to XML::Parser. Though not all callbacks are supported, you should be able to
use it in the same way you use XML::Parser. Due to using experimantal regexp features it'll work only on Perl 5.6 and above and may behave
differently on different platforms.
Note that you cannot use regular expressions or split in callbacks. This is due to a limitation of perl's regular expression implementation
(which is not re-entrant).
SUBROUTINES
/METHODS
new
Constructor.
As (almost) all SOAP::Lite constructors, new() returns the object called on when called as object method. This means that the following
effectifely is a no-op if $obj is a object:
$obj = $obj->new();
New accepts a single named parameter, "Handlers" with a hash ref as value:
my $parser = XML::Parser::Lite->new(
Handlers => {
Start => sub { shift; print "start: @_
" },
Char => sub { shift; print "char: @_
" },
End => sub { shift; print "end: @_
" },
}
);
The handlers given will be passed to setHandlers.
setHandlers
Sets (or resets) the parsing handlers. Accepts a hash with the handler names and handler code references as parameters. Passing "undef"
instead of a code reference replaces the handler by a no-op.
The following handlers can be set:
Init
Start
Char
End
Final
All other handlers are ignored.
Calling setHandlers without parameters resets all handlers to no-ops.
parse
Parses the XML given. In contrast to XML::Parser's parse method, parse() only parses strings.
Handler methods
Init
Called before parsing starts. You should perform any necessary initializations in Init.
Start
Called at the start of each XML node. See XML::Parser for details.
Char
Called for each character sequence. May be called multiple times for the characters contained in an XML node (even for every single
character). Your implementation has to make sure that it captures all characters.
End
Called at the end of each XML node. See XML::Parser for details
Comment
See XML::Parser for details
XMLDecl
See XML::Parser for details
Doctype
See XML::Parser for details
Final
Called at the end of the parsing process. You should perform any necessary cleanup here.
SEE ALSO
XML::Parser
COPYRIGHT
Copyright (C) 2000-2007 Paul Kulchenko. All rights reserved.
Copyright (C) 2008- Martin Kutter. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This parser is based on "shallow parser" http://www.cs.sfu.ca/~cameron/REX.html Copyright (c) 1998, Robert D. Cameron.
AUTHOR
Paul Kulchenko (paulclinger@yahoo.com)
Martin Kutter (martin.kutter@fen-net.de)
Additional handlers supplied by Adam Leggett.
perl v5.12.4 2011-08-29 XML::Parser::Lite(3pm)