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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to edit particular cell of csv file using shell script deepak_p86 Shell Programming and Scripting 6 04-06-2009 08:11 AM
Concatenating arrays cell values in shell scripting mathur UNIX for Dummies Questions & Answers 2 10-31-2008 08:40 AM
Shell Script Output sharpi03 Shell Programming and Scripting 4 09-20-2008 12:16 AM
Shell script getting input from output aspect_p Shell Programming and Scripting 1 03-11-2008 07:37 AM
redirecting SQL output from within a shell script soliberus Shell Programming and Scripting 2 11-23-2007 08:29 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-23-2009
sophos sophos is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 20
get output in each cell from shell script

Hi,

I have a code which gives me different values all in a same line. what do i change to make the output have each value in each cell.

code:
echo $user $firstname $lastname $address

done |
tee userinfo.xls

i want the $user value to be in first cell of excel, $firstname in the second cell etc.
  #2 (permalink)  
Old 04-23-2009
hkansal hkansal is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 69
Hello,

You are trying to write an xls file like a flat file. When you open up excel for this file, it picks the data and puts all in 1 cell.

1 (bad) way out is to save the file as csv. Excel would read it automatically as u want, using [space] or comma as delimiter.

It is advised that u use some program to write an excel sheet, using some language like java etc. I ve done this using java.

If it can be done in any other way, others maybe able to help you. I would like to know that too .

Regards,
HKansal

Last edited by hkansal; 04-23-2009 at 08:07 PM..
  #3 (permalink)  
Old 04-23-2009
giannicello giannicello is offline
Registered User
  
 

Join Date: Sep 2001
Location: Phoenix
Posts: 169
Yeah, you need to write out the file as a comma-delimited file and name it with a '.csv' extension:

Code:
echo $user, $firstname, $lastname, $address > name.csv

This will put the columns into each cell in csv/xls.
  #4 (permalink)  
Old 04-23-2009
sophos sophos is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 20
Thanks a bunch giannicello. It works perfectly fine.
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 03:25 AM.


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