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 03-24-2009, 05:55 PM   #1
pklcnu
LQ Newbie
 
Registered: Jan 2009
Posts: 5

Rep: Reputation: 0
Question How to delete Comma in a comma separated file with double quotes as quote character


Dear Experts I am new to the linux please help me with the following

I am transfering a csv file with the double quotes as quote character from Linux to Windows during this process one of the columns data is getting disturbed and written to more than one column due to the presence of comma between the double quoted column data. How can I delete the comma present with in the column data before I transfer the file from Linux to Windows. I tried few 'sed' commands but no luck.

Thanks very much in advance.
 
Old 03-24-2009, 06:39 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,266

Rep: Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079Reputation: 8079
Quote:
Originally Posted by pklcnu View Post
Dear Experts I am new to the linux please help me with the following

I am transfering a csv file with the double quotes as quote character from Linux to Windows during this process one of the columns data is getting disturbed and written to more than one column due to the presence of comma between the double quoted column data. How can I delete the comma present with in the column data before I transfer the file from Linux to Windows. I tried few 'sed' commands but no luck.

Thanks very much in advance.
Going to have to provide more information, before anyone can help you. What version of "the linux" are you using? What distro? And you say you are transferring a file between Linux and Windows...how are you transferring it? How is the file getting created in Linux? What are you reading the file with in Windows??

Chances are, the file isn't getting corrupted in transfer, and affecting just one column. Since you don't say how you're generating it, it's hard to give options, but you could try to generate a tab-delimited file, then run it through sed to strip out the commas, and sed it again, to replace the tabs with commas, leaving you with a 'sanitized' file.

Without having any real information or samples of data, it's hard to say.
 
Old 03-24-2009, 06:50 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by pklcnu View Post
Dear Experts I am new to the linux please help me with the following

I am transfering a csv file with the double quotes as quote character from Linux to Windows during this process one of the columns data is getting disturbed and written to more than one column due to the presence of comma between the double quoted column data. How can I delete the comma present with in the column data before I transfer the file from Linux to Windows. I tried few 'sed' commands but no luck.

Thanks very much in advance.
I think you should provide a sample of what the data looks like.

Look here for some relevant info (unix2dos):
http://linux.die.net/man/1/unix2dos

(there's a link at the bottom for dos2unix)
 
  


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
sorting a list into comma separated list nixlearn Linux - Newbie 22 12-03-2008 07:21 AM
help with comma separated values and what should be a simple script. zaber Programming 10 03-06-2008 01:58 PM
bash syntax: looping through a comma-separated list David the H. Linux - General 10 09-06-2007 11:23 AM
Reading comma-separated data from file MeLassen Programming 4 04-04-2004 03:41 PM
comma delimited file cdragon Programming 5 06-21-2002 08:55 PM

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

All times are GMT -5. The time now is 03:59 AM.

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
Open Source Consulting | Domain Registration