Solved

Format Lines in an .rtf document after specified tags

Posted on 2014-09-22
7
175 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

760 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

26 Experts available now in Live!

Get 1:1 Help Now