Find and replace

  • Thread starter Stephen K. Miyasato
  • Start date
S

Stephen K. Miyasato

I trying to parse this into a database and was trying to use the find and
replace to insert tab characters such that I can then programmatically parse
the data. This is a rtf file that has Indenting to indicate a sub field. For
example, Aberrant is the main topic. Adrenal gland is a subtopic and under
the paragraph heading Indentation is 0.25, Hanging by 0.5, the main topic is
left 0 hanging 0.75, the third subtopic is indent 0.5 hanging indent 0.5

Abduction contracture, hip or other joint - see Contraction, joint

Abercrombie's syndrome (amyloid degeneration) 277.3

Aberrant (congenital) - see also Malposition, congenital indent 0
hanging 0.75

adrenal gland 759.1 indent 0.25, Hanging indent 0.5

blood vessel NEC 747.60

arteriovenous NEC 747.60

cerebrovascular 747.81 indent 0.5 hanging indent 0.5

gastrointestinal 747.61

lower limb 747.64

renal 747.62

spinal 747.82

upper limb 747.63

breast 757.6

endocrine gland NEC 759.2



I tried using format and got it to find the line. I want to insert a tab ^t
before each subheading and two tabs on the third heading. The idea is such
that I can insert each into a field in the database.



When I initially tried to import it, the conversion would not recognize the
paragraph markers.



I tried using XML but this caused errors .



You can download the file from here.

http://ftp.cdc.gov/pub/Health_Statistics/NCHS/Publications/ICD9-CM/2005/dindex06.zip



Any help appreciated.



Stephen K. Miyasato
 
P

Peter Jamieson

It sounds to me as if the problem is not in the Find/Replace, but the
mechanism you are using to get the results into your database.

What is the target database? How exactly are you importing the data after
your find/replace operations?

(Also, looking at your document,

1. As far as I can see, you do not need to use the indentations to determine
which paragraphs to modify - you can specify Paragraph style H3 in the "Find
What?" and ^t^& in the Replace With, then Paragraph style H4 in "Find What?"
and ^t^t^& in "Replace with" etc.

2. are you importing the data in the lower levels (paragraph styles
H5,H6...) ? If so, are you putting three tabs at the beginning of style H5
paragraphs etc. etc.?

3. Are you deleting the H1 paragraph?

Peter Jamieson
 
C

Cindy M -WordMVP-

Hi Stephen,

You haven't stated clearly exactly what the problem is?
I trying to parse this into a database and was trying to use the find and
replace to insert tab characters such that I can then programmatically parse
the data. This is a rtf file that has Indenting to indicate a sub field. For
example, Aberrant is the main topic. Adrenal gland is a subtopic and under
the paragraph heading Indentation is 0.25, Hanging by 0.5, the main topic is
left 0 hanging 0.75, the third subtopic is indent 0.5 hanging indent 0.5

Abduction contracture, hip or other joint - see Contraction, joint

Abercrombie's syndrome (amyloid degeneration) 277.3

Aberrant (congenital) - see also Malposition, congenital indent 0
hanging 0.75

adrenal gland 759.1 indent 0.25, Hanging indent 0.5

blood vessel NEC 747.60

arteriovenous NEC 747.60

cerebrovascular 747.81 indent 0.5 hanging indent 0.5

gastrointestinal 747.61

lower limb 747.64

renal 747.62

spinal 747.82

upper limb 747.63

breast 757.6

endocrine gland NEC 759.2



I tried using format and got it to find the line. I want to insert a tab ^t
before each subheading and two tabs on the third heading. The idea is such
that I can insert each into a field in the database.



When I initially tried to import it, the conversion would not recognize the
paragraph markers.



I tried using XML but this caused errors .



You can download the file from here.

http://ftp.cdc.gov/pub/Health_Statistics/NCHS/Publications/ICD9-CM/2005/dindex06.zip



Any help appreciated.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 
S

Stephen K. Miyasato

1. As far as I can see, you do not need to use the indentations to
determine which paragraphs to modify - you can specify Paragraph style H3
in the "Find What?" and ^t^& in the Replace With, then Paragraph style H4
in "Find What?" and ^t^t^& in "Replace with" etc.
This seems to work when I go line by line with find next button. But when I
do Replace All, the word document shows only the first line of each
beginning H3 as being converted. The rest of the subsequent H3 line remains
the same with no tabs. Don't know what went wrong. I tried using paragraphs,
0.25 inches and the same thing happened. There were more than 10,000
replacements and I don't want to do this manually.

Peter Jamieson said:
It sounds to me as if the problem is not in the Find/Replace, but the
mechanism you are using to get the results into your database.
Mechanism is to import Line by line into the database. The tabs can be
converted into spaces to show indents.
What is the target database? How exactly are you importing the data after
your find/replace operations?
I plan to import this into MSSQL. In the database, I plan to show it in a
grid and therefore need the tabs to show the indents. When in this form.
I'll be able to extract the numbers into another column.
(Also, looking at your document,


2. are you importing the data in the lower levels (paragraph styles
H5,H6...) ? If so, are you putting three tabs at the beginning of style H5
paragraphs etc. etc.?

Yes, I plan on adding subsequent indents iwth tabs.
3. Are you deleting the H1 paragraph?

Yes, I'm planning to delete the H1 paragraph.

Once again I want to thank you for your help. It was very much appreciated.

Stephen K. Miyasato
 
P

Peter Jamieson

OK, if the problem is that not all the H£ paragraphs have tabs at the
beginning, after a Find/Replace, my mistake.

The best way to fix this is probably to write a macro that looks at each
paragraph and decides how many tabs to insert at the beginning. If you need
that, let me know.

Here, I tried to find a solution that did not rely on macros. If you have a
fast system, you can try the following:
a. Select the entire text, and use Table|"Convert text to table" to create
a table containing one cell for every paragraph in your document.
b. Then use exactly the same Find/Replace settings as I suggested earlier.
c. But be willing to waaaaaaaaiiiiiiiiiit...

Then, convert the table back to text if necessary (but if you select the
table, you may be able to copy it into an appropriate Access database).

Peter Jamieson
 
S

Stephen K. Miyasato

Peter,

Thanks for the help. Just to let you know that it worked.

Stephen
 

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

Similar Threads


Top