Newbie Macro Question: Deleting all words on a line except a special string

G

GoCoogs

Hello. First off I want to apologize because I already posted in
microsoft.public.word.word97vba but upon further research, I think
this is the better newsgroup for this issue.

I'm really learning macros to work with this current project. I
have tons of logs with lines looking like:

unknown (serv-2-4-73.lycos-vds.com ): 15 Time(s)

All I want from lines like these are

(serv-2-4-73.lycos-vds.com ): 15

I'm sure its very easy, but how would I delete all text (including
white space at the beginning of a line) before the first "(" and
"Time(s)" for a line? I'm sure a simple macro can do the job.

Thanks in advance,

Blake

btw, I've spent a good chunk of time researching this and feel rather
stupid for not finding a solution yet.
 
T

Tony Jollans

You can use a macro if you like - just record yourself doing this.

Ctrl+H to get the Find and Replace dialog
Find: *([\(][!\)]@[\)]: [0-9]@) *^13
Replace: \1^p
Check Use Wildcards
Hit Replace all

This assumes your lines end in paragraph marks - if they end in manual line
breaks change ^13 in the find string with ^l (caret, lowercase-L) and ^p in
the replace string also to ^l
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top