Solved

Format Lines in an .rtf document after specified tags

Posted on 2014-09-22
7
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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 32

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
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.
Suggested Courses

732 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