LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to delete Comma in a comma separated file with double quotes as quote character (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-delete-comma-in-a-comma-separated-file-with-double-quotes-as-quote-character-714155/)

pklcnu 03-24-2009 04:55 PM

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.

TB0ne 03-24-2009 05:39 PM

Quote:

Originally Posted by pklcnu (Post 3486529)
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.

pixellany 03-24-2009 05:50 PM

Quote:

Originally Posted by pklcnu (Post 3486529)
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)


All times are GMT -5. The time now is 12:41 PM.