Home Man
Search
Today's Posts
Register

If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Removing commas from CSV file

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 12-14-2017
Removing commas from CSV file

Hi
I'm creating a sh script to generate a csv file. The CSV contains the values from a sql table.
The content looks this:

Code:
 a,b,c,c2,c3,,,,,,,,,,,d,e

I have some code that can separate the fields using the comma as delimiter, but some values actually contain commas, such as c,c2,c3,,,,,,,,,

This field needs to be taken as one field and the trailing commas after c3 must be removed.
Can anybody please help in doing this ?

Thanks in advance!!

Last edited by rbatte1; 12-14-2017 at 08:55 AM.. Reason: Added CODE/ICODE tags
# 2  
Old 12-14-2017
there was a similar discussion recently.

Last edited by jgt; 12-14-2017 at 09:00 AM.. Reason: spelling
The Following User Says Thank You to jgt For This Useful Post:
RudiC (12-14-2017)
# 3  
Old 12-14-2017
Since you are creating the file, why not use a different delimiter than the comma? Semi-colon, pipe, tilde are all delimiters I have used to separate fields. Then just alter the other program to know the different delimiter.
The Following User Says Thank You to joeyg For This Useful Post:
preema (01-18-2018)
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Removing just the trailing commas :-( chardyzulu Shell Programming and Scripting 4 03-06-2013 12:14 PM
awk for removing special characters and extra commas shruthidwh UNIX for Dummies Questions & Answers 2 09-19-2011 11:24 AM
Help with removing additional commas in string ramakanth_burra Shell Programming and Scripting 3 05-25-2010 03:19 AM
Removing commas within semicolon in a flat file r_t_1601 Shell Programming and Scripting 31 06-24-2009 11:51 AM
Removing commas within semicolon in a flat file r_t_1601 Shell Programming and Scripting 10 06-16-2009 06:52 AM
parsing log files, removing spaces and replace with commas caddyjoe77 Shell Programming and Scripting 6 06-09-2009 10:02 AM
Need help in removing commas ali560045 Shell Programming and Scripting 1 04-21-2009 03:04 AM
Removing empty spaces and adding commas jazz Programming 4 11-13-2006 08:54 AM
Padding zeros after removing commas in file pranag21 HP-UX 1 11-09-2005 09:22 PM
removing commas from text file hcclnoodles UNIX for Dummies Questions & Answers 6 03-26-2003 03:43 PM


All times are GMT -4. The time now is 01:55 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password