Unix/Linux Go Back    

Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

format output in csv file

Shell Programming and Scripting

Closed Linux or Unix Question    
Thread Tools Search this Thread Display Modes
Old Unix and Linux 11-06-2009
Prashant Jain Prashant Jain is offline
Registered User
Join Date: Nov 2009
Last Activity: 30 June 2010, 6:01 AM EDT
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Unix or Linux Question format output in csv file

I am sending the output of a file to .csv file.
The output should look like this:

Total Customers Processed:,8
Total Customers Skipped:,0
Total Customers Added:,8
Total Customers Changed:,0

Total Policies Deleted:,0
Total Policies Failed:,0


Now i want this output in only one cell, i.e line break in the same cell of csv file.like, we use Alt Enter on the cell in excel.

Wht my approach is , first of all i will replace the , with something else, thn i will remove the new line character with some spaces so that data comes in different lines bt in same cell, but its not working..

Please Help.........
Sponsored Links
Old Unix and Linux 11-06-2009
Franklin52's Unix or Linux Image
Franklin52 Franklin52 is offline Forum Staff  
Join Date: Feb 2007
Last Activity: 3 October 2015, 11:55 AM EDT
Location: The Netherlands
Posts: 7,735
Thanks: 129
Thanked 550 Times in 517 Posts
Try this, suppose you want to replace the commas with spaces:

 awk 'BEGIN{printf("\"")}{gsub(","," ")}END{printf("\"")}1'  file.csv > newfile.csv

Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
format file output zerbitated Shell Programming and Scripting 1 07-21-2009 03:00 PM
format the output from a file becksram123 Shell Programming and Scripting 5 07-05-2009 09:55 PM
Output format - comparison with I/p file velappangs Shell Programming and Scripting 1 04-03-2008 06:31 AM
File Format issue: Output of sqlplus deepakgang UNIX for Dummies Questions & Answers 2 10-25-2007 03:56 AM
Format the output of file getdpg Shell Programming and Scripting 9 01-24-2006 11:50 AM

All times are GMT -4. The time now is 12:01 AM.