The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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 03:21 AM
Reading and Writing from Excel using Unix scripting AshishK UNIX and Linux Applications 3 11-08-2007 10: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 03:05 PM
How to launch a Csh shell script using Excel Macro ? Raynon Shell Programming and Scripting 1 11-08-2006 08:22 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-05-2008
Registered User
 

Join Date: Nov 2005
Posts: 22
Stumble this Post!
reading data from excel using shell script

Hi all
I am new to shell scripting.

I need to write a shell script that reads each row of an USER_ID colume in a excel file.

the excel has around 10000 rows of data.

Can someone gives me some example or advice what's best way to do this

thanks
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-05-2008
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,546
Stumble this Post!
I would recommend using a perl script to read EXCEL file.

Modules are readily available in cpan.org

Spreadsheet::ParseExcel - Get information from Excel file - search.cpan.org
Reply With Quote
  #3 (permalink)  
Old 01-05-2008
Registered User
 

Join Date: Nov 2005
Posts: 22
Stumble this Post!
Thanks for your reponse matrixmadhan

But I was told to use SH.

Does anyone know how to use SH to read excel data?

Thanks
Reply With Quote
  #4 (permalink)  
Old 01-05-2008
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Stumble this Post!
Quote:
Originally Posted by tiger99 View Post
But I was told to use SH.
Who told you?

Excel files are a proprietary binary format not simply CSV files, I strongly suggest you look to see if the Perl solution will work.

Otherwise it would be OLE Automation programming which normally requires Windows.
Reply With Quote
  #5 (permalink)  
Old 01-05-2008
Registered User
 

Join Date: Jan 2008
Posts: 5
Stumble this Post!
Tiger99,
Is the file CSV or excel (XLS)?
Reply With Quote
  #6 (permalink)  
Old 01-05-2008
Registered User
 

Join Date: Nov 2005
Posts: 22
Stumble this Post!
Thank you porter for your reponse

If I convert my excel file to csv file, is it possible to read the first column of data in csv file using shell script?

i.e (in my csv file I have)
1234,bob
2345,tom
3345,mary

What I need to accomplish is reading the first column (1234,2345,3345) using shell script and pass the number to a stored procedure for executing a select statement (select * from db where id in (1234,2345,3345 .....))

Any help in this would be really appreciated
Reply With Quote
  #7 (permalink)  
Old 01-05-2008
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Stumble this Post!
This can be done with "IFS=," and "while read A B C D E ..."

What database are you using?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0