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)
Hi all,
I have a pattern like this in a file:
123 4 56 789
234 5 67 789
121 3 56 789
222 4 65 789
321 6 90 100
478 8 40 789
243 7 80 789
How can I count the number of occurences of '789' (4th column) in this set...?
Thanks for all your help!
K (7 Replies)
Hi all
Can anybody suggest me, how to get the count of digits in a word
I tried
WORD=abcd1234
echo $WORD | grep -oE ] | wc -l
4
It works in bash command line, but not in scripts :mad: (12 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)
im trying to count the number of occurences of column 2 value(starting from KKK*) of the below file, file.txt
using the code cat file.txt | awk ' BEGIN { print "Category Counts"} {FS=","} {NR > 2} { cats = cats + 1} END { for(c in cats) { print c, "=", cats} } '
but its returning as
... (6 Replies)
Hello world,
Can anybody tell me how to count how many times does a word repeat in a file? There have been many threads on this but they all are heavy loads of Scripting for a starter like me. :D
So, I sat down today and after some hours of reading man pages, I found a simple one-line... (18 Replies)
Hi Guys,
I have 2 files like below
file1
xx
yy
file2
b
yy
b2
xx
c1
yy
xx
yy
Now I want an idea which can count occurences of text from file1 and file2 so outbout would be kind of (9 Replies)
I have some files as shown below
GLL ALM 654-656 654 656
SEM LYG 655-657 655 657
SEM LYG 655-657 655 657
ALM LEG 656-658 656 658
ALM LEG 656-658 656 658
ALM LEG 656-658 656 658
LEG LEG 658-660 658 660
LEG LEG 658-660 658 660 The value of GLL is... (5 Replies)
Hi, I would like to count the number of ALA occurences without having them to be repeated. In the script I have written now it has 40 repetitions of ALA but it has to be 8. ALA is chosen as one of the 20 values it can have when the script asks for the input of AAA, which for this example is chosen... (7 Replies)
Discussion started by: Aurimas
7 Replies
LEARN ABOUT MOJAVE
xml::libxml::nodelist
XML::LibXML::NodeList(3) User Contributed Perl Documentation XML::LibXML::NodeList(3)NAME
XML::LibXML::NodeList - a list of XML document nodes
DESCRIPTION
An XML::LibXML::NodeList object contains an ordered list of nodes, as detailed by the W3C DOM documentation of Node Lists.
SYNOPSIS
my $results = $dom->findnodes('//somepath');
foreach my $context ($results->get_nodelist) {
my $newresults = $context->findnodes('./other/element');
...
}
API
new(@nodes)
You will almost never have to create a new NodeList object, as it is all done for you by XPath.
get_nodelist()
Returns a list of nodes, the contents of the node list, as a perl list.
string_value()
Returns the string-value of the first node in the list. See the XPath specification for what "string-value" means.
to_literal()
Returns the concatenation of all the string-values of all the nodes in the list.
to_literal_delimited($separator)
Returns the concatenation of all the string-values of all the nodes in the list, delimited by the specified separator.
to_literal_list()
Returns all the string-values of all the nodes in the list as a perl list.
get_node($pos)
Returns the node at $pos. The node position in XPath is based at 1, not 0.
size()
Returns the number of nodes in the NodeList.
pop()
Equivalent to perl's pop function.
push(@nodes)
Equivalent to perl's push function.
append($nodelist)
Given a nodelist, appends the list of nodes in $nodelist to the end of the current list.
shift()
Equivalent to perl's shift function.
unshift(@nodes)
Equivalent to perl's unshift function.
prepend($nodelist)
Given a nodelist, prepends the list of nodes in $nodelist to the front of the current list.
map($coderef)
Equivalent to perl's map function.
grep($coderef)
Equivalent to perl's grep function.
sort($coderef)
Equivalent to perl's sort function.
Caveat: Perl's magic $a and $b variables are not available in $coderef. Instead the two terms are passed to the coderef as arguments.
reverse()
Equivalent to perl's reverse function.
foreach($coderef)
Inspired by perl's foreach loop. Executes the coderef on each item in the list. Similar to "map", but instead of returning the list of
values returned by $coderef, returns the original NodeList.
reduce($coderef, $init)
Equivalent to List::Util's reduce function. $init is optional and provides an initial value for the reduction.
Caveat: Perl's magic $a and $b variables are not available in $coderef. Instead the two terms are passed to the coderef as arguments.
perl v5.18.2 2014-02-01 XML::LibXML::NodeList(3)