TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
> Richard Combs wrote:
> > Just remember to run it multiple times in case there are instances of three,
> four, or more spaces. Run it until Words tells you the Find string wasn't
> found.
>
>
> In fact, this is what occasioned the question. In sed I can do all that in one
> command, with something like
>
> sed s/' \{2,9\}/ '/g
But as Keith and Laura pointed out, replacing all multiple spaces in one swell foop can wreak havoc if spaces are used for formatting, as in code examples. So you'd want to be _certain_ there's no formatting with spaces in the file.
> which will take out anything from 2 up to 9 spaces (9 is arbitrary - I just
> figure I'm not going to find more than that, but I could make that final
> number anything up t o 255).
IMHO, if there are more than three or four spaces in a row, it's almost certain that spaces are being used for formatting.
> What I was wondering was which was the least work : convert all the word files
> into plain text, run them through sed, put them back into Word OR could I do
> it all in Word with an already existing macro?
Your Word docs must have very little formatting if you're even _considering_ round-tripping through plain text! I'd guess that running a Replace All manually even four or five times takes less time than reapplying styles to a couple of pages of the typical document.
If you have lots of docs to do (and you're sure they don't use spaces for formatting), creating a macro would be worthwhile. The Find/Replace operation is a pretty simple procedure, and you should be able to create the macro in minutes by recording it.
Richard G. Combs
Senior Technical Writer
Polycom, Inc.
richardDOTcombs AT polycomDOTcom
303-223-5111
------
rgcombs AT gmailDOTcom
303-903-6372
------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EPUB Webinar: Join STC Vice President Nicky Bleiel as she discusses tips for creating EPUB, the file format used for e-readers, tablets, smartphones, and more.