Hi All,
Am working on perl script which should delete columns in existing CSV file.
If my file is :
AA,BB,CC,DD
00,11,22,33
00,55,66,77
00,99,88,21
AA,BB... are all my headers can come in any order (e.g AA,CC,BB...) and rest are values. I want to delete column CC...
Can anybody help... (2 Replies)
Hi,
I want to delete rows that dont have a certain # of columns. In my case, rows that are less than 8 should be removed (those greater than 8 are ok).
For instance:
1 2 3 4 5 6 7 8
2 3 2 4 3 2 1 5
1 2 3 4 5 6 8
2 2 4 3 1
1 1 1 1 1 1 1 1
after:
1... (8 Replies)
Hi All,
I have two .csv's
input.csv having values as (7 columns)
ABC,A19907103,ABC DEV YUNG,2.17,1000,2157,07/07/2006
XYZ,H00213850,MM TRUP HILL,38.38,580,23308,31/08/2010
output.csv having (25 columns)
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y... (4 Replies)
I have a text file that looks like this:
1 rs523634 8.22486
1
1 rs585160 8.22488
1 rs497228 8.2249
1
1 rs600933 8.225
1 rs480106 8.22531
1 rs600199 8.22533
1 rs529015 8.22534
1 rs598894 8.22534
I want to delete the rows with empty... (2 Replies)
Hi All,
i have a .Csv file in the below format
startTime, endTime, delta, gName, rName, rNumber, m2239max, m2239min, m2239avg, m100016509avg, m100019240max, metric3min, m100019240avg, propValues
11-Mar-2012 00:00:00, 11-Mar-2012 00:05:00, 300.0, vma3550a, a-1_CPU Index<1>, 200237463, 0.0,... (9 Replies)
Hi,
I have a requirement to convert rows into columns. data looks like:
c1,c2,c3,..
r1,r2,r3,..
p1,p2,p3,..
and so on..
output shud be like this:
c1,r1,p1,..
c2,r2,p2,..
c3,r3,p3,..
Thanks in advance, (12 Replies)
Hi all, I know this sounds suspiciously like a homework course; but, it is not.
My goal is to take a file, and match my "ID" column to the "Date" column, if those conditions are true, add the total number of minutes worked and place it in this file, while not printing the original rows that I... (6 Replies)
Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns.
I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
I have a series of csv files in the following format
eg file1
Experiment Name,XYZ_07/28/15,
Specimen Name,Specimen_001,
Tube Name, Control,
Record Date,7/28/2015 14:50,
$OP,XYZYZ,
GUID,abc,
Population,#Events,%Parent
All Events,10500,
P1,10071,95.9
Early Apoptosis,1113,11.1
Late... (6 Replies)
Discussion started by: pawannoel
6 Replies
LEARN ABOUT DEBIAN
dbix::contextualfetch
DBIx::ContextualFetch(3pm) User Contributed Perl Documentation DBIx::ContextualFetch(3pm)NAME
DBIx::ContextualFetch - Add contextual fetches to DBI
SYNOPSIS
my $dbh = DBI->connect(...., { RootClass => "DBIx::ContextualFetch" });
# Modified statement handle methods.
my $rv = $sth->execute;
my $rv = $sth->execute(@bind_values);
my $rv = $sth->execute(@bind_values, @bind_cols);
# In addition to the normal DBI sth methods...
my $row_ref = $sth->fetch;
my @row = $sth->fetch;
my $row_ref = $sth->fetch_hash;
my %row = $sth->fetch_hash;
my $rows_ref = $sth->fetchall;
my @rows = $sth->fetchall;
my $rows_ref = $sth->fetchall_hash;
my @tbl = $sth->fetchall_hash;
DESCRIPTION
It always struck me odd that DBI didn't take much advantage of Perl's context sensitivity. DBIx::ContextualFetch redefines some of the
various fetch methods to fix this oversight. It also adds a few new methods for convenience (though not necessarily efficiency).
SET-UP
my $dbh = DBIx::ContextualFetch->connect(@info);
my $dbh = DBI->connect(@info, { RootClass => "DBIx::ContextualFetch" });
To use this method, you can either make sure that everywhere you normall call DBI->connect() you either call it on DBIx::ContextualFetch,
or that you pass this as your RootClass. After this DBI will Do The Right Thing and pass all its calls through us.
EXTENSIONS
execute
$rv = $sth->execute;
$rv = $sth->execute(@bind_values);
$rv = $sth->execute(@bind_values, @bind_cols);
execute() is enhanced slightly:
If called with no arguments, or with a simple list, execute() operates normally. When when called with two array references, it performs
the functions of bind_param, execute and bind_columns similar to the following:
$sth->execute(@bind_values);
$sth->bind_columns(undef, @bind_cols);
In addition, execute will accept tainted @bind_values. I can't think of what a malicious user could do with a tainted bind value (in the
general case. Your application may vary.)
Thus a typical idiom would be:
$sth->execute([$this, $that], [($foo, $bar)]);
Of course, this method provides no way of passing bind attributes through to bind_param or bind_columns. If that is necessary, then you
must perform the bind_param, execute, bind_col sequence yourself.
fetch
$row_ref = $sth->fetch;
@row = $sth->fetch;
A context sensitive version of fetch(). When in scalar context, it will act as fetchrow_arrayref. In list context it will use
fetchrow_array.
fetch_hash
$row_ref = $sth->fetch_hash;
%row = $sth->fetch_hash;
A modification on fetchrow_hashref. When in scalar context, it acts just as fetchrow_hashref() does. In list context it returns the
complete hash.
fetchall
$rows_ref = $sth->fetchall;
@rows = $sth->fetchall;
A modification on fetchall_arrayref. In scalar context it acts as fetchall_arrayref. In list it returns an array of references to rows
fetched.
fetchall_hash
$rows_ref = $sth->fetchall_hash;
@rows = $sth->fetchall_hash;
A mating of fetchall_arrayref() with fetchrow_hashref(). It gets all rows from the hash, each as hash references. In scalar context it
returns a reference to an array of hash references. In list context it returns a list of hash references.
ORIGINAL AUTHOR
Michael G Schwern as part of Ima::DBI
CURRENT MAINTAINER
Tony Bowden <tony@tmtm.com>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
DBI. Ima::DBI. Class::DBI.
perl v5.10.0 2005-09-27 DBIx::ContextualFetch(3pm)