Monday, May 18, 2009

Stupid editing trick with search and replace

So here's one of my favorite editing tricks, for assessing the use of a term throughout a document.

Do a global search and replace on the word, replacing it with a highlighted version. By highlight, I just mean surround it with some characters that stand out.

For example, I had noticed that the story I was working on had lots of uses of the word 'but'...lots of sentences like ", but". So I replaced 'but' with [[__but__]].

Review the document, either searching for the word or scanning it visually. For each case, if the usage is okay, edit it back to normal. If not, rewrite.

The virtue here is that you can stop at any time and go back and find the instances you haven't reviewed yet. And by choosing a unique string, you can easily globally change things back.

If you screw up and convert 'buttress' to [[__but__]]tress, you'll see that. When you think you're done, search on the unique string to make sure you didn't miss any.

If you use a tool like grep or the Emacs occur command, you can get a list of all the lines that contain your unique term.

No comments:

Post a Comment