delete sewctions of text using find and replace

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I need to delete certain sections of text in a word doc. and replace it with
','
for example:
the cat sat on the mat
would need to become:
the,mat
i have 4000 lines of this and do not want to have to manually delete all the
uneccessary text.

Any pointers?
 
Bonni said:
Hi,
I need to delete certain sections of text in a word doc. and replace
it with ','
for example:
the cat sat on the mat
would need to become:
the,mat
i have 4000 lines of this and do not want to have to manually delete
all the uneccessary text.

Any pointers?

CTRL-H will bring up the Replace dialog box. PUt what you have in the top
line, what you wnat it to be inthe second box, try a couple of replaces and
if it works toyour liking, hit Replace All.
 
Hi,
Its a little more complex than that. here is an actual example:

■ AACC - Association Algérienne de Lutte Contre la Corruption (Algeria)
Mailing address: Centre Familial de Ben Aknoun Alger 16 Algeria
Other address: Tel.: Fax: E-mail: Web page: http://www.transparency.org/
Category: 6. CSO Notes:

would need to become:

AACC - Association Algérienne de Lutte Contre la Corruption
(Algeria),[email protected]


any ideas? i know that i would need to do it twice to remove whatever is
before the mail address and that which comes after the address.

thanks.
 
How similar are the entries? and where did the email address come from? and
is this really what you want:

AACC - Association Algérienne de Lutte Contre la Corruption
(Algeria),[email protected]

with no space between the , and the start of the email address.

If you give full information, you will have a much better chance of getting
a useful response.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
Hi Doug,
Thanks for the tips. What you say is exactly correct. Basically what i have
is a word document with a list of contacts. From that all i need is the name
and country and email address. Each entry is identically ordered (name,
country, mailing address, other address,tel, fax, email, web page, category,
CSO notes). basically what i want to do is delete everything from 'Mailing
address' to 'email' and replace it with a ',' with no spaces before or after
the comma. i will then be able to save this as *.csv and import it into
Outlook as a contact base (after applying the same process to what appears
after the email address).

I hope this is more informative.
 
If the entries are all in the same format. Use the method described at
http://www.gmayor.com/convert_labels_into_mail_merge.htm to convert them to
a table then either use mail merge to a directory format to extract the bits
you want, or delete the unwanted columns and convert the table back to text.
If the entries are not all the same, then you can use replace to remove the
unwanted similar bits - see
http://www.gmayor.com/replace_using_wildcards.htm .

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Can't help when the details needed come in piece-meal. You need to state
the problem correctly but so far still looks like a Replace operation.
Can't help further; too few details.
 
Bonni:
What Graham says is indeed the solution in my opinion. In addition,
however, you may need some creativity to make it work for you. If you
convert Text to Table you need to be sure that the end of the record is
marked w/ a hard return and the fields within a record are TABs. You
can then import into Excel smoothly, manipulate columns (remove, change
order, ...) and save the file as a *.csv.
The creativity comes in to get tabs and hard returns appropriately. If
all fields in a record are separated by hard returns too, getting it
into Excel will not help you as all fields are in one column. If you
have no paragraph breaks (except for the last which Word adds by
default), then you need to find a way to automatically create end of
record breaks. This could be TWO consecutive Line breaks, or any other
unique separating series of characters. (Line breaks can be replaced by
tabs, by Replace ^l (small "L") by ^t). Otherwise, assuming you dont
have two e-mail addresses in one record, you could replace the @ by @^p
so the record splits in the middle of the e-mail address. Now yr
records are "skewed", but in a repeated, consistent pattern so can be
fixed in Excel (the email address can be restored w/ CONCATENATE.)
I hope this all makes sense and that you can get it working.
Henk
 
Back
Top