![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to read the data from an excel sheet and use those data as variable in the unix c | Anne Grace | UNIX for Advanced & Expert Users | 1 | 03-03-2008 04:21 AM |
| Reading and Writing from Excel using Unix scripting | AshishK | UNIX and Linux Applications | 3 | 11-08-2007 11:49 PM |
| script for reading BLOB data | shriashishpatil | Shell Programming and Scripting | 0 | 04-25-2007 04:11 PM |
| Need help with complicated script (reading directories, extracting data) | Gill Bates | Shell Programming and Scripting | 3 | 02-20-2007 04:05 PM |
| How to launch a Csh shell script using Excel Macro ? | Raynon | Shell Programming and Scripting | 1 | 11-08-2006 09:22 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
Hi porter
Should I be storing the data from csv file in a variable? I use sybase Thanks |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
I thought you would be reading the data from the separate columns then generating the "insert" SQL statements.
|
|
#10
|
|||
|
|||
|
IMHO, If your goal is to select the first column out of your csv/xls file, and then use it in a stored procedure, I would suggest that you use awk to extract out the first column into a flat file, load that file into a temp table and then reference the temp table from your stored procedure.
Not sure how many rows you will have in thie csv/xls file, but the more rows you will have, the tricky it will be to pass it into the stored procedure. Look for a more robust solution. |
|
#11
|
|||
|
|||
|
Hi porter
sorry, I would not be doing any "insert" SQL statement. I need to 1. use shell script to read the first column of data in csv file 2. pass the data to a sybase stored procedure using shell script 3. in the stored procedure, I would have a "select" SQL statement (i.e select * from db where id in (1234,2345,....)) 1234,2345... are data from the first column of the csv file. I hope I make my question clear Thanks |
|
#12
|
|||
|
|||
|
this is one way how you get your first column data
Code:
# cut -f1 -d"," < csvfile | paste -sd"," 1234,2345,3345 Code:
cmd="select * from table where id in ( `the above command` )" isql -uUser -Sserver <options> << EOF exec procedure $cmd EOF |
|||
| Google The UNIX and Linux Forums |