Csv Find And Replace Application / Script

I need an application that will parse a CSV file and do text replacement based on specified criteria. Here’s roughly what it should be able to do:

1) Upload a CSV file
2) Define text to search for
3) Define text that should replace 2) above
4) Set which field number in the CSV record should be searched
5) Set to replace only the first instance of the text per record or all
6) Flag all EMPTY records, with zero hits, where there is no match
7) Repeat the search and replace with new text strings on the EMPTY records only
8) When done, generate a new CSV file

A little more information about:

Item 4 above – If for example the CSV file has 50 records, consisting of 5 comma delimited fields each, I’d like to be able to specify that the script should only search field #2 for example and ignore all other fields in the record.

Item 5 above – If the keyword string appears more than once in the specified field, I may want to replace only the first occurrence in each record with the replacement text.

Item 6 above – The goal is to continue processing the CSV file until there are zero records which has not had some form of replacement done. Each record and the associated field will have to be processed at some time, but only once. Once it has been successfully processed and some of the text relaced the record has to be skipped for the next processing run till all are done.

Technology:
I like hosted apps so if this can be done with PhP, great. That being said, I don’t mind if this is a desktop app either. Let me know if your bid how you plan to approach this and what technology you plan to use.

Leave a Reply

Your email address will not be published. Required fields are marked *