Thursday, November 30, 2006

The power of regular expressions

So I needed to change every one of our ACE #include preprocessor macros that was globally scoped to be locally scoped.

In other words, every reference such as:

#include <ace/foo.H>

needed to be converted to:

#include "ace/foo.H"

There were about two hundred of them spread across 430 files.

Ah, the power of regex:


sed -i '/^#include <ace/s/[<>]/"/g' *.cpp