Site icon Bytefreaks.net

Linux Bash: How to find a string inside C/C++ Source and Header Files

Advertisements

Just issue the following in the folder of the source codes and replace ‘FIND ME’ with the string you want to query:

find -O3 . -regex '.*\.\(c\|cpp\|h\)

You can change the contents of the regular expression to search in different file extensions (file types).  -exec grep 'FIND ME!' -sl '{}' \;

You can change the contents of the regular expression to search in different file extensions (file types). 

This post is also available in: Αγγλικα

Exit mobile version