LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-21-2009, 04:22 AM   #1
jeesun
Member
 
Registered: Aug 2007
Location: Australia
Distribution: RedHat Enterprise
Posts: 82

Rep: Reputation: 15
Redirect output in .xls or csv format


Dear All

I have a shell script which is purging files and show the output in stdout. How can I redirect the output which shows in stdout in CSV or XLS format?

My script need to pass some input before showing output.
 
Old 12-21-2009, 04:34 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Hi. Can you provide an example of what you get on the standard output and what you wish? Redirecting the output to a CSV file can be performed by parsing the text and placing the commas in the proper positions. Creating a XLS is far more complicate, since this should involve (for example) scripting in OpenOffice. For this reason I would stick with the CSV solution, since you can easily import it into any spreadsheet program.
 
Old 12-22-2009, 02:38 AM   #3
jeesun
Member
 
Registered: Aug 2007
Location: Australia
Distribution: RedHat Enterprise
Posts: 82

Original Poster
Rep: Reputation: 15
Please check the script
Attached Files
File Type: txt scriptz.txt (1.3 KB, 135 views)
 
Old 12-22-2009, 02:52 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Well, your script has no comments inside. A brief explanation (speech) of what you get and what is the desired output would be appreciated. Using code tags to preserve spacing would be even better.
 
Old 12-23-2009, 11:06 PM   #5
jeesun
Member
 
Registered: Aug 2007
Location: Australia
Distribution: RedHat Enterprise
Posts: 82

Original Poster
Rep: Reputation: 15
Currently the output of this script is

DateandTime What
---------------------- -----------------------------------------------------------------------
24_Dec_09_Thu_09:46:30 mon
menu.sh
ssh host
mon
date

But this output comes in standard output. But I need this output as it is in csv format.
 
Old 12-25-2009, 05:56 PM   #6
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
In the last line, you should be able to aud > output.csv or something.

What exactly did you try?

End
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl convert csv to xls hawk__0 Programming 3 09-16-2009 09:13 AM
Script to convert csv 2 xls or odt xowl Linux - Software 1 01-16-2007 09:06 PM
export redhat linux csv file to xls bbgtilak Linux - General 4 12-27-2006 07:53 AM
xls to csv or ascii Shioni Linux - Software 1 08-04-2006 05:04 AM
Parsing XLS or CSV in Perl - what and what not me_the_apprentice Programming 13 02-28-2006 03:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration