Solved

Format Lines in an .rtf document after specified tags

Posted on 2014-09-22
7
180 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Re-indent word doc 5 41
Word - Access 3 48
In MS Word, rename styles in a batch 9 42
Word 2016 Search Comments 5 31
It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

910 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

22 Experts available now in Live!

Get 1:1 Help Now