Issue with Tab separator and Backslash

72 views
Skip to first unread message

marcde...@gmail.com

unread,
Nov 2, 2016, 4:08:00 PM11/2/16
to csvfix
Hi Neil,

the reason why I almost always prefer tab separated files
is there is no need to quote or escape anything since no
person I have ever known would have a TAB in their data.

I have noticed there are problems with a tab separated file
if the field ends with a backslash "\".
I have got the following tab separated file "testbs.txt":
Name    Code
Chrysalis\    00148

The name "Chrysalis\" is depicted as it is with backslash.

The command csvfix.exe read_dsv -s \t testbs.txt
produces the following csv file:
"Name","Code"
"Chrysalis    00148"

This means the backslash is removed because csvfix assumes
I want to escape the tab sign following after the backslash.
However, it is the expected behaviour, see the help for read_dsv
"If a value needs to contain the delimiter, then it must be escaped
using a backslash, as must any occurrences of the backslash itself."

This is really a bit tedious because I should have to double write
the backslash to get the desired output.
Name    Code
Chrysalis\\    00148

Is there an option to avoid backslash escaping?

Thank you.

Neil Butterworth

unread,
Nov 2, 2016, 4:23:26 PM11/2/16
to csvfix
With this and other questions here, you seem to imagine that CSVfix is some general-purpose text-processing tool. It isn't, It is intended to be a CSV (comma-separated variables) processor. I added the ability to deal partially with some other formats (XML, TSV), etc. but in neither case is it a complete solution to dealing with those formats, and it isn't intended to be.

Also, one question per day (or less) please.
Reply all
Reply to author
Forward
0 new messages