The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 07:21 AM
Reading and Writing from Excel using Unix scripting AshishK UNIX and Linux Applications 3 11-09-2007 02:49 AM
script for reading BLOB data shriashishpatil Shell Programming and Scripting 0 04-25-2007 07:11 PM
Need help with complicated script (reading directories, extracting data) Gill Bates Shell Programming and Scripting 3 02-20-2007 07:05 PM
How to launch a Csh shell script using Excel Macro ? Raynon Shell Programming and Scripting 1 11-08-2006 12:22 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-05-2008
tiger99 tiger99 is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 22
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
  #2 (permalink)  
Old 01-05-2008
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
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
  #3 (permalink)  
Old 01-05-2008
tiger99 tiger99 is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 22
Thanks for your reponse matrixmadhan

But I was told to use SH.

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

Thanks
  #4 (permalink)  
Old 01-05-2008
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
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.
  #5 (permalink)  
Old 01-05-2008
stateful stateful is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 7
Tiger99,
Is the file CSV or excel (XLS)?
  #6 (permalink)  
Old 01-05-2008
tiger99 tiger99 is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 22
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
  #7 (permalink)  
Old 01-05-2008
porter porter is offline Forum Advisor  
Registered User
  
 

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

What database are you using?
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0