Page 1 of 1

edit deliniated text

Posted: Thu Dec 04, 2003 6:47 pm
by jonsea212
Hi,

I have a deliniated text file that has 7 populated fields. Each field is seperated by a comma. What i want to do is find and replace only one field. Say like a find and replae on field 6 or field 7 etc.


thanks in advance,

jon

Posted: Thu Dec 04, 2003 8:16 pm
by talleyrand
Hello,
I suspect a regular expression would suit your needs, basically one that says I want to search and replace between the fifth and sixth instance of (whatever marker the file uses (commas, pipes, tabs)) where it looks like this. I think that would work but alas my regexp foo is not great.

The quick and dirty method would be to use OpenOffice's spreadsheet application (or that other office spreadsheet) and edit it through there.

Posted: Thu Dec 04, 2003 9:02 pm
by s_reynisson
talleyrand is right of course, but IMHO Bill has already sold way to
many copies of that other office spreadsheet! :wink: HTH

Using POSIX
find (([^,]*,){6})string1(.*)
replace \1string2\3