LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-23-2014, 11:20 PM   #1
mangal023
LQ Newbie
 
Registered: Nov 2013
Location: Chennai, India
Posts: 6

Rep: Reputation: Disabled
Shell script output in .csv format


Hi All,

The o/p of my is like this

test1: unrecognized service
test2: running
test3: ACTIVE

Please help me how to convert this o/p into .csv format so that i can save in excel directly without manual editing

Last edited by mangal023; 02-23-2014 at 11:26 PM.
 
Old 02-23-2014, 11:55 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

if you just want to change it from space separated to comma separated you can use tr. Eg something like:
Code:
tr ' ' ',' < infile.txt > outfile.csv
Evo2.
 
Old 02-24-2014, 01:37 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,550

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
If you have written the script, why not just edit it to output the data as you like?
 
Old 02-24-2014, 10:54 PM   #4
mangal023
LQ Newbie
 
Registered: Nov 2013
Location: Chennai, India
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi evo2 and grail,

Thanks for your inputs.

I got what i required from echo -e.
i used echo -e "test;" "\c \t"

Now i could just copy the o/p and paste in the excel workbook.

-mangal023
 
  


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
[SOLVED] howto: ls output to csv format limdel Linux - Newbie 12 09-19-2014 02:00 PM
Putty using csv files in BASH to format file in script as output smks Linux - Newbie 7 12-22-2011 06:50 PM
Shell Script format question - output command results in quotes Barefootpanda Linux - General 5 10-14-2008 12:40 AM
Shell script to parse csv-like output, row by row utahnix Linux - General 8 12-08-2007 06:03 AM
Shell script help with function and output format altrob Programming 4 09-27-2006 03:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:42 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration