Page 1 of 1

Adding new lines with find and replace

Posted: Sun Nov 22, 2009 4:32 am
by forward1
I publish a list of U.S. hospitals that use social media: http://ebennett.org/hsnl The data is managed in an Excel file, and my conversion process is:

1. Sort the primary excel table by organization name
2. Build out a single text file using the CONCATENATE function
3. Take the text file and process it with TextpipePro into HTML

This works fine for a single A to Z list, but I'd like also split the list by State. I can sort the excel file by State, then organization name to get a text file with the right order, but then I need a Textpipe filter that will:

1. Find the first occurrence of a unique string
2. Insert a new line of text above the line with that match.

Attached are my working files and current TP filter. I build unique text patterns around each data element, which makes Find and Replace easy to manage.

Any help is appreciated, and I'm also willing to hire an expert. I can be reached at ed@ebennett.org

Thank you.

Re: Adding new lines with find and replace

Posted: Mon Nov 23, 2009 7:06 am
by DataMystic Support
The way to do this is to make use of a perl pattern like this:

Code: Select all

(state).*(\1)
\1 matches whatever the earlier bracket matched, so you can detect duplicates this way. This might give you a way forward