Re: sed search and replace
From: Ed Morton (morton_at_lsupcaemnt.com)
Date: Mon, 25 Jul 2005 16:31:50 -0500
William James wrote:
> firstname.lastname@example.org wrote:
>>I have a CSV file which I created by concatenation of multiple files.
>>In some of the files the fields are also delimited with double quotes.
>>I'd like to double quote all the fields. Not sure how to achieve this
>>- please help
> The data in a field in a csv file is allowed to contain anything:
> commas, double-quotes, linefeeds, zero bytes.
Then does this line mean:
or something else?
Williams awk script converts that line to this:
which is either adding a ," in the middle of the second field (if the
correct interpretation is the first form above) or deleting the " that
follows c in the input file if it's the second form above.
Chris's shell script converts that line to:
which means it's treating it like the second set of fields above.
Anyone know what the correct output should be and why?