Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6648129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:37:08+00:00 2026-05-26T00:37:08+00:00

I have a number of word documents that I’d like to remove some elements

  • 0

I have a number of word documents that I’d like to remove some elements from. What I would like to do is as follows:

  1. Copy and paste the entire contents of the word file (may not be necessary) and move it into a text file OR Convert .doc to .txt
  2. Using regex: replace \[.*\] with “” AND replace \(.*\) with “”
  3. Save the result to a text file with the same name as the original word document.

Thoughts and direction appreciated. As it stands now, I don’t know how to do any of these things programatically. I’m doing this manually as it stands.

If it matters, I’m using Ubuntu 11.04

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:37:08+00:00Added an answer on May 26, 2026 at 12:37 am

    Since you’re open to using plain text, some improvements to your algo:

    1. Use antiword to automate conversion from doc to tx
    2. Use sed to do in-place regex modification: sed -i -e's/bad/good/' file.txt

    Update (in response to comment):

    The regexes are fine, but I didn’t understand the objective completely:

    • if you want to replace occurrences of [foo] & (foo) with “” use:

      sed -i -e's/\[.*\]/""/g' file.txt; sed -i -e's/\(.*\)/""/g' file.txt

    • if you want to replace occurrences [foo] & (foo) with “foo” each use:

      sed -i -e's/\[\(.*\)\]/"\1"/g' file.txt; sed -i -e's/(\(.*\))/"\1"/g' file.txt

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of documents (mainly Word and Excel) that I'd like to
I have a number of word documents I am converting. Everything is going great
I have some 100.000+ text documents. I'd like to find a way to answer
I have huge number of Word files I need to merge (join) into one
I have a number of code value tables that contain a code and a
I have a number of tables that use the trigger/sequence column to simulate auto_increment
I have a VBA macro for Microsoft Word that I am trying to improve.
I have a big load of documents, text-files, that I want to search for
I have a Word document that starts with a Table of Contents. I need
We have millions of simple txt documents containing various data structures we extracted from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.