The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Formatting Output dhanamurthy Shell Programming and Scripting 6 05-02-2008 12:43 PM
Formatting bdf output Cameron Shell Programming and Scripting 5 04-09-2008 10:05 AM
formatting output balaji_prk Shell Programming and Scripting 4 09-15-2007 10:23 AM
Formatting output illur81 Shell Programming and Scripting 3 10-13-2005 10:24 AM
Formatting the output Cameron Shell Programming and Scripting 7 02-15-2002 10:30 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 07-06-2008
chris1234 chris1234 is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 74
Question about formatting the output

I need to ask a question on how to format the output in a csv format. Right now i am running a shell script which executes a command and the following output is append through a unix script in a .csv file.

So the output of xyz.csv is as follow :-


Code:
1. Number = 25 Amount $84,132.22
2. Number = 26 Amount $1.02
3. Number = 92 Amount $0.00
4. Number = 85 Amount $24,618.59
.
.
.

Now if i view it in excel the output is all messed up. The headers are printed in one column and the values are also printed in one column except for decimal values which are printed in the second column.

How can i make it allign perfectly to view it in the CSV file which is formatted?

Last edited by chris1234; 07-06-2008 at 07:51 PM..
  #2 (permalink)  
Old 07-07-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,313
1st you have to tell which fields/columns should be used, like for example using the semicolon as delimiter:

Code:
1.;Number = 25;Amount $84,132.22
2.;Number = 26;Amount $1.02
3.;Number = 92;Amount $0.00
4.;Number = 85;Amount $24,618.59

Then someone here in the forum would be able to write a short awk/sed line to make your file a csv-File. What you showed is no csv file, it's just some lines where nothing is really separated by an unique delimeter.
When you got a delimeter then ie. a "real" csv-File, you can import it to Excel and the columns will be recognized by defining the right delimeter.
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 06:48 PM.


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