In a folder on my system, I have a C++ project that I'm trying to compile.This process uses some C++ idioms which are not supported by my compiler version. In particular, often inside the code it is used the data value 'nullptr'.What I want to do is to replace all occurrences of nullptr with NULL.I can do this in VIM with the command::%s/nullptr/NULL/g How can I do this for all the files in a directory once, without opening each file and executing the command?
Replace all the occurences of a term in the files contained in a folder
files;text processing
Two ways to do this:vimYou can use vim from the command line like so:$ vim -c %s/nullptr/NULL/g|wq foo.txtWrap in a for loop:$ for i in *; do vim -c %s/nullptr/NULL/g|wq -- $i; donePerl$ perl -p -i -e 's/nullptr/NULL/g' foo.txtWrap in a for loop:$ for i in *; do perl -p -i -e 's/nullptr/NULL/g' -- $i; doneOr simply:$ perl -p -i -e 's/nullptr/NULL/g' -- *