Solved

Format Lines in an .rtf document after specified tags

Posted on 2014-09-22
7
181 Views
Last Modified: 2014-09-22
Someone sent me a .txt file with information that they ultimately want to be placed in a FileMaker database, but I have to do some work on it before it gets there. I copied the text in to a Word file and saved it as an .rtf file. What I am needing to do is have the lines after the tags be changed to a bold format and the tags removed. Below is a sample of the data given to me (with names and addresses changed for privacy). There are over 74,000 words in the document so I need some way to automate the task.
@T=Echo Hill,  Ryanville, Any State
@I=Location: 6 miles north of Ryanville on Hwy Z72 at the Hwy A71 intersection
@S=Leader
John Henry, Box 1234, Ryanville, ZZ 12345
@S=Echo Hill School
Box 9999, Andyville, ZZ
@S=Board Members
Harvey Junior
Gavin Sarupta
Sergio Gonzalves

Here is how I would like it to look.
Echo Hill,  Ryanville, Any State
Location: 6 miles north of Ryanville on Hwy Z72 at the Hwy A71 intersection
Leader
John Henry, Box 1234, Ryanville, ZZ 12345
Echo Hill School
Box 9999, Andyville, ZZ
Board Members
Harvey Junior
Gavin Sarupta
Sergio Gonzalves

How would I go about changing the selected lines to a Bold format?
0
Comment
Question by:wcsjas
  • 3
  • 3
7 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 40337370
Assuming that the lines are in fact paragraphs, you should be able to do that in Word using a wildcard Find and Replace. You can check this with the Show/Hide (¶) toggle button. This allows the format characters to be seen. The lines should end with the same pilcrow symbol, so:

@T=Echo Hill,  Ryanville, Any State¶

Select all of the text that needs to be changed. Unless there are tagged lines that you wish to exclude, use Ctrl+A to select the whole document.

Open the Find and Replace dialogue with Ctrl+H.

Type this in the Find box:
\@[A-Z]{1}=(*^13)

Open the hidden part of the dialogue with the More>> button, and tick the 'Use Wildcards' checkbox.

Type this into the  Replace box:
\1

Set Bold format via the Format button, Font... item.

Click on the Replace All button.
0
 

Author Comment

by:wcsjas
ID: 40337466
That definitely did the trick! Can you explain (or point me to a website) how that works? That's some fancy 'Find and Replace' that I've never seen. I think I can follow this part \@[A-Z] but the rest of it didn't quite make sense.
0
 

Author Closing Comment

by:wcsjas
ID: 40337468
Thanks for the quick reply!
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40337595
\@[A-Z]{1}=(*^13)

\     is the escape character in this context, so \@ means 'look for the @ character, and do not use its special meaning in Word search'
[A-Z]     means any upper-case letter
{1}     means one only of the previous list in the square brackets
=      as is
(       start of the first replacement string
*      any number of any character until the next searched-for character
^13    paragraph mark. Note that in the replace string and in all non-wildcard find or replace strings, ^p will do the same job.
)      end of the first replacement string

For the replacement code, \1 means, replace with the string found within the first round-bracketed text in the Find

Here is an excellent reference link;

http://word.mvps.org/FAQs/General/UsingWildcards.htm
0
 
LVL 31

Expert Comment

by:Paul Sauvé
ID: 40337623
Graham - you knowledge of (what I consider) obscure uses of Word functions always impresses me!

Paul
0
 

Author Comment

by:wcsjas
ID: 40337689
Wow! Thanks again. Learn a little every day!
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40337807
Thanks Paul,
I'm still crap with pictures :)

wcsjas,
It is a pleasure to help anyone who wants to learn
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PDF to Word 25 153
How to Find/Replace a carriage return in Google Docs 5 687
VBA/SQL - Connect to SQL server and pull data 4 107
Printing A1 on A4 Printer 8 144
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now