Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've got a huge (about half a GiB, impossible to use a usual text editor on) CSV file with fields enclosed in double quotes like "abc","def" but need a file without quotes (I am sure this is not going to break the file consistency - a comma is never used inside the values in it).

How to remove all the quotes (without introducing spaces on their places)?

share|improve this question
add comment

1 Answer 1

up vote 9 down vote accepted

tr can do that:

tr -d \" < infile > outfile

You could also use sed:

sed 's/"//g' < infile > outfile
share|improve this answer
    
Why did you removed < infile > outfile? IMHO it was more informative. –  Ivan Dec 14 '12 at 9:27
    
@Ivan I thought it was probably implicit on second thought. –  Chris Down Dec 14 '12 at 9:29
    
Only when for experienced command line users. Even though I a have used < before a couple of times (to import SQL scripts into MySQL and SQLite) It would be immediately obvious for me that I should use < in this case. I think it would be better to return the full command line example back for further reference of those who may need it. –  Ivan Dec 14 '12 at 9:35
    
@Ivan and @Chris, I've reverted it back (pending review) to include < infile > outfile, hope that's OK. –  donothingsuccessfully Dec 14 '12 at 11:22
    
Thanks, @donothingsuccessfully. I've totally mistyped the previous comment, that's a pity I can't edit it %-] –  Ivan Dec 14 '12 at 13:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.