Page 1 of 1

Converting CSV to tab delimited with TP

Posted: Mon Sep 15, 2014 10:49 pm
by kengrubb
I'm using TP to convert a CSV (Comma Separated Values) file to a tab delimited file.

I first performed this RE Replace until no more lines were changed.

Find what: "([^,"\r\n]+),([^"\r\n]+)"
Replace with: "$1\xFF$2"

This was to convert commas delimited between double quotes (") to \xFF (ÿ), which was not in the file.

Then this RE Replace.

Find what: ,
Replace with: \t

This was to convert commas which are true delimiters to \t (tab).

Finally this RE Replace.

Find what: \xFF
Replace with: ,

This was to convert commas within double quote delimiters back to commas.

I suppose Excel 2010 could do this, but it's an almost 900 MB file and I tend not to trust tools that convert stuff and "help me" when I want to see the really, real bytes. Hence, I use TP for such tasks.

Posted: Mon Sep 15, 2014 10:51 pm
by kengrubb
Duh moment.

My question was, could others suggest potential problems or issues with this approach? Are there things I'm missing?

Running Win7 Ent 64bit and TP 7.4.0 64bit

Posted: Mon Sep 15, 2014 11:42 pm
by kengrubb
My grand plan appeared to fall apart in TP, but I seem to have recovered fully in WE.

Note to self and others, when working with 800MB or larger files, use WE instead of TP.

One of the niceties of both TP and WE using ECMA Regex is that what works in one will work in the other.

Posted: Tue Sep 30, 2014 7:15 pm
by Ryck
kengrubb wrote:My grand plan appeared to fall apart in TP, but I seem to have recovered fully in WE.

Note to self and others, when working with 800MB or larger files, use WE instead of TP.

One of the niceties of both TP and WE using ECMA Regex is that what works in one will work in the other.
I think that's what WildEdit was for. I never knew what the file size limit was. 800 MB is a good benchmark. Probably 500 MB with my system. LOL