CSV to TSV (was Re: Tools & techniques for one-off consolidation of multiple 'similar' CSV files?)

Keith Clarke keith.clarke at me.com
Tue Apr 5 12:36:11 EDT 2022


This code sits early in the process of preparing CSV file data (from files that I didn’t create, so their content is unknown) into TSV text for onward processing.
 
So, the logic here is attempting to address the very concerns that you raise, albeit in reverse order i.e. 
- remove any tab characters with (future) special meaning from the (CSV) data before introducing tabs as delimiters - to avoid false item-breaks downstream.
- swap out the two forms of CSV delimiter (commas between quotes and commas) with the alternative tab delimiters
…and finally clean up any orphan quotes left at the beginning of the first item in the line or end of the last.  

Best,
Keith 

> On 5 Apr 2022, at 17:09, Mike Kerner via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I'm confused by the code, above. If you are using tab as your column
> delimiter, then you wouldn't replace it with a space, since your tsv/csv
> files would have tabs in them when they were exported, originally.
> In any case, when you are going to replace a character with another
> character, you should make sure that the character you are replacing it to
> either a) does not have any special meaning (e.g. a delimiter) or b) if it
> does have a special meaning that it does not appear in the data, already.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list