Office Letter: Removing Dupes in Word - InformationWeek

InformationWeek is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them.Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

IoT
IoT
News
Commentary
10/26/2005
10:26 PM
Commentary
Commentary
Commentary
50%
50%

Office Letter: Removing Dupes in Word

Here's a clever search-and-replace string to remove duplicate paragraphs from a Word document.

Bill Coan, the brains behind one of our favorite utilities (DataPrompter), wrote with this enhancement to a previous reader tip about deleting duplicate entries in a Word list:

    Claudio Faria offered a great tip on removing duplicates in Word. As you'll recall, she suggested using Word's Edit>Replace command and then placing a checkmark next to Use Wildcards. With wildcards enabled, Claudio recommended entering the following values into the Replace dialog box:

    Find What: ([!^13]@)^13\1^13 Replace With: \1^p

    The only drawback to this approach is that you have to click Replace repeatedly until Word has found and deleted all duplicate paragraphs.

    I'd like to offer a small refinement to Claudio's technique, which makes it possible to find and delete all duplicate paragraphs with a single click. As with Claudio's technique, you start by sorting your document so that identical paragraphs are situated contiguously. Then you choose Edit>Replace and place a checkmark next to Use Wildcards. Then you enter the following values into the Replace dialog box:

    Find What: ([!^13]@)^13(\1^13)@ Replace With: \2 When you click Replace, Word finds and deletes all duplicate paragraphs. For a full explanation of the wildcard search terms, please review Claudio's excellent summary in the last issue. What follows is a condensed explanation of why this works:

    Find What: ([!^13]@)^13

    The above expression means: "Find one or more non-paragraph-marks followed by a paragraph mark" (i.e., find a complete paragraph).

    Find What: ([!^13]@)^13(\1^13)

    The above expression means: "Find one or more non-paragraph-marks followed by a paragraph mark followed by an identical series of non-paragraph-marks followed by a paragraph mark" (i.e., find a complete paragraph followed by an identical complete paragraph).

    Find What: ([!^13]@)^13(\1^13)@

    The above expression means: "Find one or more non-paragraph-marks followed by a paragraph mark followed by one or more identical series of non-paragraph-marks followed by a paragraph mark" (i.e., find a complete paragraph followed by one or more identical complete paragraphs).

    Replace With: \2

    The above expression means: "Replace the found text with the second parenthetical expression in the Find What text" (i.e., Replace the found text with a single copy of the complete paragraph).

    -- Bill Coan, www.wordsite.com

Editor's note: Don't miss our review of DataPrompter. Thanks for your insight, Bill. If you have a tip to share with Office Letter readers, please send it to [email protected]

The Office Letter is a weekly e-mail and online newsletter offering tips, tricks, and techniques for Microsoft Office. It offers shortcuts, explores features, and boosts productivity with hands-on how-to information for Word, Excel, Outlook, PowerPoint, and more.

We welcome your comments on this topic on our social media channels, or [contact us directly] with questions about the site.
Comment  | 
Print  | 
More Insights
State of the Cloud
State of the Cloud
Cloud has drastically changed how IT organizations consume and deploy services in the digital age. This research report will delve into public, private and hybrid cloud adoption trends, with a special focus on infrastructure as a service and its role in the enterprise. Find out the challenges organizations are experiencing, and the technologies and strategies they are using to manage and mitigate those challenges today.
News
COVID-19: Using Data to Map Infections, Hospital Beds, and More
Jessica Davis, Senior Editor, Enterprise Apps,  3/25/2020
Commentary
Enterprise Guide to Robotic Process Automation
Cathleen Gagne, Managing Editor, InformationWeek,  3/23/2020
Slideshows
How Startup Innovation Can Help Enterprises Face COVID-19
Joao-Pierre S. Ruth, Senior Writer,  3/24/2020
Register for InformationWeek Newsletters
Video
Current Issue
IT Careers: Tech Drives Constant Change
Advances in information technology and management concepts mean that IT professionals must update their skill sets, even their career goals on an almost yearly basis. In this IT Trend Report, experts share advice on how IT pros can keep up with this every-changing job market. Read it today!
White Papers
Slideshows
Twitter Feed
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.
Sponsored Video
Flash Poll