... I was trying my code on ideone.com which was not printing where the error ...
stderr from your original code on ideone.com :
... looks like a semicolon is missing in the preceding line.
Quote:
... I wasn't trying to say RudiC code is wrong. I was getting the above mentioned output on ideone.com now since i am at work i will try it on my terminal and yes MCOL i did try to print it by saying
or
instead of
. ...
You should try to make very clear, what variables and arrays you use, and what values they are assigned (if at all), and where this might deviate from what you expect.
Hi,
I am new to this forum and new to awk.
I have a file that contains 2 columns.
Heres an example of what it looks like:
10 +
20 +
40 +
50 -
70 -
So the file is tab-delimited. What I want to do is add 10 to column 1 whenever column 2 is + and substract 10 from column 1... (1 Reply)
Hi,
I have below as i/p file:
5ABC 36488989 K 000010000ASB BYTRES
5PQR 45757754 K 000200005KPC HGTRET
5ABC 36488989 K 000045000ASB HGTRET
5GTH 36488989 K 000200200ASB BYTRES
5FTU ... (2 Replies)
Hi All,
I have a file example.csv which looks like this
GrpID,TargetID,Signal,Avg_Num
CSCH74_1_1,2007,61,256
CSCH74_1_1,212007,647,679
CSCH74_1_1,12007,3,32
CSCH74_1_1,207,299,777
I want the output as
GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num
CSCH74_1_1,2007,61,256... (4 Replies)
Hi All,
I have a file example.csv which looks like this
GrpID,TargetID,Signal,Avg_Num
CSCH74_1_1,2007,61,256
CSCH74_1_1,212007,647,679
CSCH74_1_1,12007,3,32
CSCH74_1_1,207,299,777
I want the output as
GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num
CSCH74_1_1,2007,61,256... (1 Reply)
I have a following inputfile
MT,AP,CDM,TTML,MUM,GS,SUCC,3
MT,AP,CDM,TTSL,AP,GS,FAIL,9
MT,AP,CDM,RCom,MAH,GS,SUCC,3
MT,AP,CDM,RTL,HP,GS,SUCC,1
MT,AP,CDM,Uni,UPE,GS,SUCC,2
MT,AP,CDM,Uni,MUM,GS,SUCC,2
TTSL,AP,GS,MT,MAH,CDM,SUCC,20
TTML,AP,GS,MT,MAH,CDM,FAIL,10... (2 Replies)
i have file input
aaa ccc,45567,rterw,1
bbb dcs,564543,hjghgh,1
aaa ccc,454,rterw,6
i want to sum based on column 1
expected output
aaa ccc,7
bbb dcs,1 (4 Replies)
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)
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)
Hi All,
I have a file as below and want to sum based on the id in the first column
Input
10264;ATE; 12
10265;SES;11
10266AUT;50
10264;ATE;10
10265;SES;13
10266AUT;89
10264;ATE;1
10265;SES;15
10266AUT;78
Output
10264;ATE; 23
10265;SES;39
10266AUT;139 (6 Replies)
Discussion started by: arunkumar_mca
6 Replies
LEARN ABOUT OSX
dbix::class::resultsetcolumn
DBIx::Class::ResultSetColumn(3) User Contributed Perl Documentation DBIx::Class::ResultSetColumn(3)NAME
DBIx::Class::ResultSetColumn - helpful methods for messing
with a single column of the resultset
SYNOPSIS
$rs = $schema->resultset('CD')->search({ artist => 'Tool' });
$rs_column = $rs->get_column('year');
$max_year = $rs_column->max; #returns latest year
DESCRIPTION
A convenience class used to perform operations on a specific column of a resultset.
METHODS
new
my $obj = DBIx::Class::ResultSetColumn->new($rs, $column);
Creates a new resultset column object from the resultset and column passed as params. Used internally by "get_column" in
DBIx::Class::ResultSet.
as_query
Arguments: none
Return Value: [ $sql, @bind ]
Returns the SQL query and bind vars associated with the invocant.
This is generally used as the RHS for a subquery.
next
Arguments: none
Return Value: $value
Returns the next value of the column in the resultset (or "undef" if there is none).
Much like "next" in DBIx::Class::ResultSet but just returning the one value.
all
Arguments: none
Return Value: @values
Returns all values of the column in the resultset (or "undef" if there are none).
Much like "all" in DBIx::Class::ResultSet but returns values rather than row objects.
reset
Arguments: none
Return Value: $self
Resets the underlying resultset's cursor, so you can iterate through the elements of the column again.
Much like "reset" in DBIx::Class::ResultSet.
first
Arguments: none
Return Value: $value
Resets the underlying resultset and returns the next value of the column in the resultset (or "undef" if there is none).
Much like "first" in DBIx::Class::ResultSet but just returning the one value.
single
Arguments: none
Return Value: $value
Much like "single" in DBIx::Class::ResultSet fetches one and only one column value using the cursor directly. If additional rows are
present a warning is issued before discarding the cursor.
min
Arguments: none
Return Value: $lowest_value
my $first_year = $year_col->min();
Wrapper for ->func. Returns the lowest value of the column in the resultset (or "undef" if there are none).
min_rs
Arguments: none
Return Value: $resultset
my $rs = $year_col->min_rs();
Wrapper for ->func_rs for function MIN().
max
Arguments: none
Return Value: $highest_value
my $last_year = $year_col->max();
Wrapper for ->func. Returns the highest value of the column in the resultset (or "undef" if there are none).
max_rs
Arguments: none
Return Value: $resultset
my $rs = $year_col->max_rs();
Wrapper for ->func_rs for function MAX().
sum
Arguments: none
Return Value: $sum_of_values
my $total = $prices_col->sum();
Wrapper for ->func. Returns the sum of all the values in the column of the resultset. Use on varchar-like columns at your own risk.
sum_rs
Arguments: none
Return Value: $resultset
my $rs = $year_col->sum_rs();
Wrapper for ->func_rs for function SUM().
func
Arguments: $function
Return Value: $function_return_value
$rs = $schema->resultset("CD")->search({});
$length = $rs->get_column('title')->func('LENGTH');
Runs a query using the function on the column and returns the value. Produces the following SQL:
SELECT LENGTH( title ) FROM cd me
func_rs
Arguments: $function
Return Value: $resultset
Creates the resultset that "func()" uses to run its query.
throw_exception
See "throw_exception" in DBIx::Class::Schema for details.
AUTHORS
Luke Saunders <luke.saunders@gmail.com>
Jess Robinson
LICENSE
You may distribute this code under the same terms as Perl itself.
perl v5.16.2 2012-10-18 DBIx::Class::ResultSetColumn(3)