Search and replace hundreds of strings in tens of thousands of files?
- by C Johnson
I am looking into changing the file name of hundreds of files in a (C/C++) project that I work on. The problem is our software has tens of thousands of files that including (i.e. #include) these hundreds of files that will get changed. This looks like a maintenance nightmare. If I do this I will be stuck in Ultra-Edit for weeks, rolling hundreds of regex's by hand like so:
^\#include.*["<\\/]stupid_name.*$
with
#include <dir/new_name.h>
Such drudgery would be worse than peeling hundreds of potatoes in a sunken submarine in the antarctic with a spoon.
I think it would rather be ideal to put the inputs and outputs into a table like so:
stupid_name.h <-> <dir/new_name.h>
stupid_nameb.h <-> <dir/new_nameb.h>
stupid_namec.h <-> <dir/new_namec.h>
and feed this into a regular expression engine / tool / app / etc...
My Ultimate Question: Is there a tool that will do that?
Bonus Question: Is it multi-threaded?
I looked at quite a few search and replace topics here on this website, and found lots of standard queries that asked a variant of the following question:
standard question: Replace one term in N files.
as opposed to:
my question: Replace N terms in N files.
Thanks in advance for any replies.