get output in each cell from shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting get output in each cell from shell script
# 1  
Old 04-23-2009
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  
Old 04-23-2009
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 Smilie.

Regards,
HKansal

Last edited by hkansal; 04-23-2009 at 08:07 PM..
# 3  
Old 04-23-2009
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  
Old 04-23-2009
Thanks a bunch giannicello. It works perfectly fine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to call and sort awk script and output

I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
Discussion started by: Eric7giants
1 Replies

2. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

3. Shell Programming and Scripting

Cell color based on Status in HTML output

Hi, I need to get the Status Column in Green if it is approved and Red if it is declined in the HTML output attachment#!/bin/bash body_csv="/authlistener/ProdA/service/queryRS.csv" body_html="/authlistener/ProdA/service/queryRS.html" ... (1 Reply)
Discussion started by: maddelav
1 Replies

4. UNIX for Beginners Questions & Answers

Putting query result dynamically to one cell of table from shell

I have to send a data in mail table format.only one cell need to get dynamically from query. my code is like (echo '<table boarder="1"> echo '<tr><td>stock</td><td>/path</td><td>.........</td></tr>' echo '</table> )sendmail.. in ......... I am trying to get query result.By putting query... (2 Replies)
Discussion started by: meera_123
2 Replies

5. Shell Programming and Scripting

Shell Script function to use script name for log file output

Hi Team - I"m very new to Shell Scripting so I have a rather novice question. My forte is Windows Batch Scripting so I was just wondering what the Shell Script equivalent is to the DOS command %~n? %~n is a DOS variable that dispayed the script name. For instance (in DOS): REM... (11 Replies)
Discussion started by: SIMMS7400
11 Replies

6. Shell Programming and Scripting

How to create multiline csv cell through shell script?

Hi, I have a text like the one given below status="Observation 1" read1="Source rows not load" read2="Score drop" I want to create a csv and mail it out in such a way that all three lines will be in a single cell but as three lines. For ex Col C1 ... (3 Replies)
Discussion started by: prasperl
3 Replies

7. Shell Programming and Scripting

shell script no output

xxxxxx (4 Replies)
Discussion started by: vinayrao
4 Replies

8. Shell Programming and Scripting

[How To?] Run shell script and get output into another shell.

Hi guys, I have a simple question, I want to store the output of the following command: As you can see it is running all the time, and we get a new line every 3sec. I just want to store these new lines into a single variable, so I can use it into a script. To clear the screen, and... (4 Replies)
Discussion started by: Thireus
4 Replies

9. Shell Programming and Scripting

How to edit particular cell of csv file using shell script

I have one csv file and in that I want update particular cell. I know the row and coloumn number for that respective. Please help me... (6 Replies)
Discussion started by: deepak_p86
6 Replies

10. UNIX for Dummies Questions & Answers

Concatenating arrays cell values in shell scripting

Hi All, I want to concatenate the array cell values and form a string.. Is it possible? for ex. I have an array word_array contains d u m b and after concatenating the string shld be 'dumb' thanks (2 Replies)
Discussion started by: mathur
2 Replies
Login or Register to Ask a Question