On Mon, 2007-06-18 at 13:11 -0700, John Machin wrote: 
> On Jun 19, 4:12 am, [EMAIL PROTECTED] wrote:
> > I have a csv file containing lot of rows & columns. I wanted to search thru 
> > the
> > heading for each column for a string and then print all the headings and the
> > corresponding rows if a match is found.
> >
> > Any advise?

you can put cvs in a MySql DB
mysql -e 'CREATE TABLE table2(col1 VARCHAR(255), col2 VARCHAR(255), col3
VARCHAR(255), col4 VARCHAR(255), col5 VARCHAR(255), col6 VARCHAR(255),
col7 VARCHAR(255), col8 VARCHAR(255), col9 VARCHAR(255), col10
VARCHAR(255), col11 VARCHAR(255), col12 VARCHAR(255), col13
VARCHAR(255), col14 VARCHAR(255))' table2

in mysql:
load data infile '/home/sergio/pesquisa/table2.txt' into table table2
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';

and work with python and mysql 
http://dustman.net/andy/python/python-and-mysql

> 
> 1. Clarify your requirements: "corresponding rows" ... corresponding
> to what? How many rows/columns is a "lot"? "I have a csv file" ...
> only one? "search thru the heading for each column for a string" is
> open to misinterpretation of various kinds :-)
> 2. Write your script.
> 3. Ask a specific question if you have a problem.
> 
-- 
Sérgio M. B.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to