Page 1 of 1

android enable log in all the C++ files

Posted: Sat Apr 11, 2015 2:38 am
by fabiodelorenzo
find all the cpp files and, for each file, if it contains "//#define LOG_NDEBUG 0" , replace it with "#define LOG_NDEBUG 0" removing the //

Code: Select all

find . -name *.cpp | xargs  grep "\/\/#define LOG_NDEBUG 0" -l  | xargs sed -i "s/\/\/#define LOG_NDEBUG 0/#define LOG_NDEBUG 0/g"


NB: the // have to be escaped into \/\/



The expression:

Code: Select all

"s/\/\/#define LOG_NDEBUG 0/#define LOG_NDEBUG 0/g"


is like any normal string replacement in vi:
:1,% s/needle/haystack/g