to count the number of occurences of a column value
im trying to count the number of occurences of column 2 value(starting from KKK*) of the below file, file.txt
Quote:
Results of comparison of prod and swp table ran on 07142010
Client_ID,Category,Mrkt,PrdWk
4875,KKKPTOR,test,test # to start the count from here
4875,KKKPTOR,tst,tst3
4875,KKKTYUR,zz,zr
4875,KKKVBFF,zo,zt
4875,KKKPTOR,we,wy
4875,KKKSDSL,tt,te
4875,KKKDFSD,yy,yw
4875,KKKDFSD,yn,ya
4875,KKKTYUR,tt,te
4875,KKKTYUR,tt,te
4875,KKKTYUR,tt,te
4875,KKKSDSL,tt,te
4875,KKKDFSD,tt,te
using the code
but its returning as
Quote:
Category Counts
KKKPTOR = 3
of = 1 # need to avoid this count
KKKTYUR = 4
KKKDFSD = 3
KKKSDSL = 2
KKKVBFF = 1
Category = 1 # need to avoid this count as well
how to avoid the script processing the line number 1 and 2 as you can see it returns "of = 1" and "Category = 1". Pls throw some light.Im using ksh.
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)
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)
Hello,
I have a text file with n lines in the following format (9 column fields):
Example:
contig00012 149606 G C 49 68 60 18 c$cccccacccccccccc^c
I need to count the number of lower-case and upper-case occurences in column 9, respectively, of the... (3 Replies)
Hi All,
I have the following input which i want to process using AWK.
Rows,NC,amount
1,1202,0.192387
2,1201,0.111111
3,1201,0.123456
i want the following output
count of rows = 3 ,sum of amount = 0.426954
Many thanks (2 Replies)
This is the source file, we called it errorlist.out
196 server_a server_unix_2 CD
196 server_b server_win_1 CD
196 server_c server_win_2 CD
196 server_bd server_unix_2 CD
196 server_d server_unix_2 CD
196 server_es server_win_1 CD
196 ... (14 Replies)
Hi
I was going through the below thread
https://www.unix.com/shell-programming-scripting/48535-how-count-number-fields-record.html
I too have something similar requirement as specified in this thread but the number of columns in my case can be very high, so I am getting following error.
... (3 Replies)
Hi i have data like
abchd 124 ldskc aattggcc
each separated by tab space i want to count number of characters in 4th column and print it in new column with tabspace for every line can anyone help me how to do it.
Thanks. (3 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)
What is an efficient way of counting the number of unique values in a 400 column by 1000 row array and outputting the counts per column, assuming the unique values in the array are:
A, B, C, D
In other words the output should look like: Value COL1 COL2 COL3
A 50 51 52... (16 Replies)
Discussion started by: Geneanalyst
16 Replies
LEARN ABOUT DEBIAN
wiki::toolkit::plugin::categoriser
Wiki::Toolkit::Plugin::Categoriser(3pm) User Contributed Perl Documentation Wiki::Toolkit::Plugin::Categoriser(3pm)NAME
Wiki::Toolkit::Plugin::Categoriser - Category management for Wiki::Toolkit.
DESCRIPTION
Uses node metadata to build a model of how nodes are related to each other in terms of categories.
SYNOPSIS
use Wiki::Toolkit;
use Wiki::Toolkit::Plugin::Categoriser;
my $wiki = Wiki::Toolkit->new( ... );
$wiki->write_node( "Red Lion", "nice beer", $checksum,
{ category => [ "Pubs", "Pub Food" ] }
) or die "Can't write node";
$wiki->write_node( "Holborn Station", "busy at peak times", $checksum,
{ category => "Tube Station" }
) or die "Can't write node";
my $categoriser = Wiki::Toolkit::Plugin::Categoriser->new;
$wiki->register_plugin( plugin => $categoriser );
my $isa_pub = $categoriser->in_category( category => "Pubs",
node => "Red Lion" );
my @categories = $categoriser->categories( node => "Holborn Station" );
METHODS
new
my $categoriser = Wiki::Toolkit::Plugin::Categoriser->new;
$wiki->register_plugin( plugin => $categoriser );
in_category
my $isa_pub = $categoriser->in_category( category => "Pubs",
node => "Red Lion" );
Returns true if the node is in the category, and false otherwise. Note that this is case-insensitive, so "Pubs" is the same category as
"pubs". I might do something to make it plural-insensitive at some point too.
subcategories
$wiki->write_node( "Category Pub Food", "mmm food", $checksum,
{ category => [ "Pubs", "Food", "Category" ] }
) or die "Can't write node";
my @subcats = $categoriser->subcategories( category => "Pubs" );
# will return ( "Pub Food" )
# Or if you prefer CamelCase node names:
$wiki->write_node( "CategoryPubFood", "mmm food", $checksum,
{ category => [ "Pubs", "Food", "Category" ] }
) or die "Can't write node";
my @subcats = $categoriser->subcategories( category => "Pubs" );
# will return ( "PubFood" )
To add a subcategory "Foo" to a given category "Bar", write a node called any one of "Foo", "Category Foo", or "CategoryFoo" with
metadata indicating that it's in categories "Bar" and "Category".
Yes, this pays specific attention to the Wiki convention of defining categories by prefacing the category name with "Category" and
creating a node by that name. If different behaviour is required we should probably implement it using an optional argument in the
constructor.
categories
my @cats = $categoriser->categories( node => "Holborn Station" );
Returns an array of category names in no particular order.
SEE ALSO
o Wiki::Toolkit
o Wiki::Toolkit::Plugin
AUTHOR
Kake Pugh (kake@earth.li). The Wiki::Toolkit team (http://www.wiki-toolkit.org/)
COPYRIGHT
Copyright (C) 2003-4 Kake Pugh. All Rights Reserved.
Copyright (C) 2006-2009 the Wiki::Toolkit team. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2009-10-25 Wiki::Toolkit::Plugin::Categoriser(3pm)