01-26-2008
Column sum group by uniq records
Dear All,
I want to get help for below case.
I have a file like this.
saman 1
gihan 2
saman 4
ravi 1
ravi 2
so i want to get the result,
saman 5
gihan 2
ravi 3 like this.
Pls help me.
Thank you.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
i have a file where the records are like this.
vt100 2048 D402 MG0010 0
586 262144 D403 MG0011 1000
486 8192 D404 MG0012 270
386 8192 A423 CC0177 40
586 65536 A424 CC0182 670
486 16384 A423 CC0183 100
486 16384 A425 CC0184 80
65000 4096 B407 EE1027 80
I want firstly,
to count how... (10 Replies)
Discussion started by: sickboy
10 Replies
2. Shell Programming and Scripting
I have a file in the following format. Groups of data merge together and the group number is indicated above each group.
1
adrf
dfgr
dfg
2
dfgr
dfgr
3
dfef
dfr
fd
4
fgrt
fgr
fgg
5
fgrt
fgr (3 Replies)
Discussion started by: Lucky Ali
3 Replies
3. Shell Programming and Scripting
Hi All
I do have a file like this with 6 columns. Groups of data merge together and the group number is indicated above each group.
1
1 12 26 289 3.2e-027 GCGTATGGCGGC
2 12 26 215 6.7e+006 TTCCACCTTTTG
3 9 26 175 ... (1 Reply)
Discussion started by: Lucky Ali
1 Replies
4. Shell Programming and Scripting
Hello All ,
I have a problem with summing of column by group
Input File -
COL_1,COL_2,COL_3,COL_4,COL_5,COL_6,COL_7,COL_8,COL_9,COL_10,COL_11
3010,21,1923D ,6,0,0.26,0,0.26,-0.26,1,200807
3010,21,192BI ,6,24558.97,1943.94,0,1943.94,22615.03,1,200807
3010,21,192BI... (8 Replies)
Discussion started by: jambesh
8 Replies
5. Shell Programming and Scripting
12-11-2012,PNL,158406
12-11-2012,RISK,4564
12-11-2012,VAR_1D,310101
12-11-2012,VAR_10D,310101
12-11-2012,CB,866
12-11-2012,STR_VAR_1D,298494
12-11-2012,STR_VAR_10D,309623
09-11-2012,PNL,1024106
09-11-2012,RISK,4565
09-11-2012,VAR_1D,317211
09-11-2012,VAR_10D,317211
09-11-2012,CB,985... (7 Replies)
Discussion started by: manas_ranjan
7 Replies
6. Shell Programming and Scripting
Hi,
I have a similar input format-
A_1 2
B_0 4
A_1 1
B_2 5
A_4 1
and looking to print in this output format with headers. can you suggest in awk?awk because i am doing some pattern matching from parent file to print column 1 of my input using awk already.Thanks!
letter number_of_letters... (5 Replies)
Discussion started by: prashob123
5 Replies
7. Shell Programming and Scripting
Hi,
I have a table to be imported for R as matrix or data.frame but I first need to edit it because I've got several lines with the same identifier (1st column), so I want to sum the each column (2nd -nth) of each identifier (1st column)
The input is for example, after sorted:
K00001 1 1 4 3... (8 Replies)
Discussion started by: sargotrons
8 Replies
8. UNIX for Dummies Questions & Answers
Hi All,
I have a requirement where I need to find sum of values from column D through O present in a CSV file and check whether the sum of each Individual column matches with the value present for that corresponding column present in the trailer record.
For example, let's assume for column D... (9 Replies)
Discussion started by: tpk
9 Replies
9. Shell Programming and Scripting
I want to bring values in the second column into single line for uniq value in the first column.
My input
jvm01, Web 2.0 Feature Pack Library
jvm01, IBM WebSphere JAX-RS
jvm01, Custom01 Shared Library
jvm02, Web 2.0 Feature Pack Library
jvm02, IBM WebSphere JAX-RS
jvm03, Web 2.0 Feature... (10 Replies)
Discussion started by: kchinnam
10 Replies
10. Shell Programming and Scripting
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (1 Reply)
Discussion started by: as7951
1 Replies
LEARN ABOUT DEBIAN
class::makemethods::utility::textbuilder
MakeMethods::Utility::TextBuilder(3pm) User Contributed Perl Documentation MakeMethods::Utility::TextBuilder(3pm)
NAME
Class::MakeMethods::Utility::TextBuilder - Basic text substitutions
SYNOPSIS
print text_builder( $base_text, @exprs )
DESCRIPTION
This module provides a single function, which implements a simple "text macro" mechanism for assembling templated text strings.
$expanded_text = text_builder( $base_text, @exprs )
Returns a modified copy of $base_text using rules from the @exprs list.
The @exprs list may contain any of the following:
o A string, in which any '*' characters will be replaced by the base text. The interpolated string then replaces the base text.
o A code-ref, which will be called with the base text as its only argument. The result of that call then replaces the base text.
o A hash-ref, which will be added to the substitution hash used in the second pass, below.
o An array-ref, containing additional expressions to be treated as above.
After any initial string and code-ref rules have been applied, the hash of substitution rules are applied.
The text will be searched for occurances of the keys of the substitution hash, which will be modified based on the corresponding value in
the hash. If the substitution key ends with '{}', the search will also match a balanced block of braces, and that value will also be used
in the substitution.
The hash-ref may contain the following types of rules:
o 'string' => 'string'
Occurances of the first string are to be replaced by the second.
o 'string' => code_ref
Occurances of the string are to be replaced by the results of calling the subroutine with no arguments.
o 'string{}' => 'string'
Occurances of the first string and subsequent block of braces are replaced by a copy of the second string in which any '*' characters
have first been replaced by the contents of the brace block.
o 'string{}' => code_ref
Occurances of the string and subsequent block of braces are replaced by the results of calling the subroutine with the contents of the
brace block as its only argument.
o 'string{}' => hash_ref
Occurances of the string and subsequent block of braces are replaced by using the contents of the brace block as a key into the
provided hash-ref.
EXAMPLE
The following text and modification rules provides a skeleton for a collection letter:
my $letter = "You owe us AMOUNT. Please pay up!
" .
"THREAT{SEVERITY}";
my @exprs = (
"Dear NAMEm
*",
"*
-- The Management",
{ 'THREAT{}' => { 'good'=>'Please?', 'bad'=>'Or else!' } },
" DATE
*",
{ 'DATE' => 'Tuesday, April 1, 2001' },
);
One might invoke this template by providing additional data for a given instance and calling the text_builder function:
my $item = { 'NAME'=>'John', 'AMOUNT'=>'200 camels', 'SEVERITY'=>'bad' };
print text_builder( $letter, @exprs, $item );
The resulting output is shown below:
Tuesday, April 1, 2001
Dear John,
You owe us 200 camels. Please pay up!
Or else!
-- The Management
SEE ALSO
See Class::MakeMethods for general information about this distribution.
perl v5.10.1 2004-09-06 MakeMethods::Utility::TextBuilder(3pm)