Replacing a sting in multiple MS word doc's

September 17, 2010 at 03:34:33
Specs: Ubuntu 10.04
Hi All

I currently have a structure of several folder levels all containing a large number of MS word documents (9000 doc's), however a large number of these doc's have Client names in the documents. I have been given the wonderful task of changing all the client names to specific client numbers so we don't breach confidentiality. I have tried several different ways to do this in NT and have given up on that idea and now it over to the Unix to hopefully save the day again.

I'm a complete n33b at coding so i was hoping someone might be able to help me out? any ideas?

i.e. replace "Client ABC" with "Client 123" in folder /opt/aq/docs/ including all subfolders.

Any help would be much appreciated.

thanks
AJ



See More: Replacing a sting in multiple MS word docs

Report •

#1
September 17, 2010 at 11:54:43
I have 2 questions:

1) what version of Word were your files created under
2) what unix version are you using

Just for fun, I ftp'ed a Word 97 file over to Solaris 9. I could not operate on it because Word files are binary - not ascii. Classic Unix tools just will not work on binary files. (Generally, concatenating a binary file on Solaris messes up your terminal)

GNU tools (i.e. Linux) are more forgiving. Over the weekend, I will give it a shot and see what happens. I don't think it will work, but it's worth a shot.


Report •

#2
September 18, 2010 at 03:33:44
Usually doc files contain formatting characters embedded within the string you are searching for, A seach and replace will not work. You will probably have to open with Word to find all occurrences of the search string. Maybe a keyboard macro could automate the process.

Report •

#3
April 4, 2011 at 05:52:45
Thank you all for you help, this was eventually achieved with a grep & | on an old mac i had :)


Report •
Related Solutions


Ask Question