LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 04: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, 05:39 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,637

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
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, 05: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



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

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

All times are GMT -5. The time now is 04:32 PM.

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