Could a good grep samaritan help me out of "find and replace" purgatory into BBEdit heaven?
I have a lovely script for Entourage on Mac OS X which looks through my inbox, winnows out the unique senders and creates a file of all the addresses so I get an address book of everyone who has ever contacted me. I have used this on a regular basis to slim down my Entourage database, which works well.
The only problem with the list is that the email addresses are joined to the sender names with a line of dots, so having created the file year after year I can't now easily import the addresses into a new e-mail application.
So far I've always used BBEdit for extremely basic find and replace operations, but I get the impression that it would be able to clean this address book file, if only I knew the right grep. And considering I'm a total heathen in this regard, I'm really struggling. Every combination I have tried so far has rendered some portion of the address book unusable.
Here is an example of what I have:
Sender Name.............................E-mail Address
Kida....................................kida@address.com
........................................xxxx@aol.com
bluematter..............................support@bluematter.com
........................................support@btclick.com
I believe there are forty characters / dots before each address, so one solution could be simply to find the first forty characters of each line and delete them.
The other could be to delete the first two dots that appear before any letter of the alphabet, to leave a space. That would make the e-mail addresses clean again.
Can anyone advise me? Thanks
\.\.+\w
should do the match (a . then at least one more . then a word character)
If you're putting this into a replace string you need to save the word pattern to go in the replace bit - put it in brackets.
so to get, say, csv, search for
\.\.+(\w)
and replace with
,\1
I'm not a bbedit person but i think this should work.
posted by handee at 6:26 AM on February 26, 2007