Adding new lines with find and replace

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

forward1
Posts: 2
Joined: Tue Jan 04, 2005 10:28 am
Location: Baltimore, Maryland USA
Contact:

Adding new lines with find and replace

Postby forward1 » Sun Nov 22, 2009 4:32 am

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.
Attachments
TPFiles.zip
Sample files
(104.34 KiB) Downloaded 210 times

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Adding new lines with find and replace

Postby DataMystic Support » Mon Nov 23, 2009 7:06 am

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
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 3 guests