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: 28 November 2015, 2:50 PM EST
Location: The Netherlands
Posts: 7,740
Thanks: 130
Thanked 553 Times in 519 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 04:00 PM
format the output from a file becksram123 Shell Programming and Scripting 5 07-05-2009 10:55 PM
Output format - comparison with I/p file velappangs Shell Programming and Scripting 1 04-03-2008 07:31 AM
File Format issue: Output of sqlplus deepakgang UNIX for Dummies Questions & Answers 2 10-25-2007 04:56 AM
Format the output of file getdpg Shell Programming and Scripting 9 01-24-2006 12:50 PM

All times are GMT -4. The time now is 10:38 PM.