Re: Problem with smart quoting

74 views
Skip to first unread message

Neil Butterworth

unread,
Nov 14, 2012, 11:45:28 AM11/14/12
to csvfix
No, it did work. Smart quoting, as its name suggests, is smart - it
only quotes fields that absolutely need it, which is those containing
commas, quotes or newline characters. If you want to force quoting of
a field, whether it is needed or not, you need to use the -sqf flag,
but this only applies to entire columns. There is no general way in
CSVfix of maintaining the exact quoting of input through to output.

Neil Butterworth

On Nov 14, 12:38 pm, hoainam <hoainam.co...@gmail.com> wrote:
> Dear,
>
> Suppose I have below csv file (named input.abc):
> R1,1,"ABC",2
> R2,"MNP",3,4
> R3,5,6,"XYZ"
>
> You can see that in this file, in each record we have 01 field that
> contains Text string in double quotes.
>
> Then I use echo command (for example) to copy data to other files as below:
>
> REM --- WITHOUT -smq
> csvfix echo input.abc > output1.abc
>
> REM --- AND WITH -smq
> csvfix echo -smq input.abc > output2.abc
>
> And here the results:
>
> output1.abc
> "R1","1","ABC","2"
> "R2","MNP","3","4"
> "R3","5","6","XYZ"
>
> output2.abc
> R1,1,ABC,2
> R2,MNP,3,4
> R3,5,6,XYZ
>
> So I found that -smq did not work because if it did, output2.abc should be
> exactly the same input.abc
>
> Please support me
>
> Thanks!

Neil Butterworth

unread,
Nov 14, 2012, 12:36:39 PM11/14/12
to csvfix
No, I can't think of a workaround, and given the current
implementation of CSVfix, none is really possible - or particularly
desirable, IMHO. It's certainly not something I intend to implement in
the future. Sorry.

On Nov 14, 4:59 pm, hoainam <hoainam.co...@gmail.com> wrote:
> Thanks for your prompt support!
>
> So any work-around to do this task? I think it is more convenience if
> csvfix supports maintaining the exact quoting of input through to output
Reply all
Reply to author
Forward
0 new messages