Hi ,
I am using SUN OS Version 5.6.
I have a file that contains records of length 270. when I do 'set nu' in vi editor, I get the count as 86. whereas when I do "wc -l" on the command prompt, it shows the count as only 85. this is very strange. why would the 'wc' show 1 record less. The job... (3 Replies)
I want to count the number of occurence of perticular word from one text file.
Please tell me "less" command is work in ksh or not. If it is not working then instead of that which command will work. :confused: (40 Replies)
hello everyone,
I'm trying to learn some scripts but i cant get my head around two of them.
1. how can i write a script that will count the number of times a particular word is used in file?
2. how can i make a script that will take me to a web page from unix?
if anyone could help it... (3 Replies)
I want to count the number of occurences of say "200" in a file but that file also contains various stuff including dtaes like 2007 or smtg like 200.1 so count i am getting by doing grep -c "word" file is wrong
Please help!!!!! (8 Replies)
I am a newbie in UNIX shell script and seeking help on this UNIX function. Please give me a hand. Thanks.
I have a large file. Named as 'MyFile'. It was tab-delmited. I am told to write a shell function that counts the number of occurrences of the ord “mysring” in the file 'MyFile'. (1 Reply)
Hi Experts,
I want to know the count of specific word in a file. I have almost 600+ files.
So I want to loop thru each file and get the count of the specific word.
Please help me on achieving this...
Many thanks (2 Replies)
Hi All,
I have a file of decimal numbers,
cat file1.txt
1.1382666907
1.2603107334
1.6118799297
24.4995857056
494.7632588468
560.7633734425
.....
I want to see the output as only 7 digits after decimal (5 Replies)
I'm trying to count the number of times each word in the file exist
for example if the file has:
today I have a lot to write, but I will not go for it. The main thing is that today I am looking for a way to get each word in this file with a word count after it specifying that this word has... (4 Replies)
I am trying to figure out to find word count of each word from my file
sample file
hi how are you
hi are you ok
sample out put
hi 1
how 1
are 1
you 1
hi 1
are 1
you 1
ok 1
wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 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)