LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 05: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, 05:34 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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, 03: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, 18 views)
 
Old 12-22-2009, 03:52 AM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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-24-2009, 12:06 AM   #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, 06:56 PM   #6
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 658

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

What exactly did you try?

End
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 10:13 AM
Script to convert csv 2 xls or odt xowl Linux - Software 1 01-16-2007 10:06 PM
export redhat linux csv file to xls bbgtilak Linux - General 4 12-27-2006 08:53 AM
xls to csv or ascii Shioni Linux - Software 1 08-04-2006 06:04 AM
Parsing XLS or CSV in Perl - what and what not me_the_apprentice Programming 13 02-28-2006 04:44 AM


All times are GMT -5. The time now is 04:51 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration