My nightmare come when i want to search files by content in Mac!. Last time i used to search files by content using Dreamweaver (Window) and it’s a no brainer. Today, i manage to find myself the Mac / Linux command that able to search files by content and now it solve my many years problem :p
To search files by content in Mac / Linux, follow the steps below:-
Advertisements
- Go to your terminal
- Using the sample below, you may change the criteria according to your needs:-
find ./ -name "*.php" -print | xargs grep "split("
*** the example above will search all the .php file for the content of split( under the current directory. And below is the example of result of the search:-
# this is the result of the search ./model/Users.class.php: $result = split(":", $data);
- To make the command easier to understand, copy the command below and replace #path#, #file_extension# and #content_you_want_to_find# to your search criteria
find #path# -name "*.#file_extension#" -print | xargs grep "#content_you_want_to_find#"
Happy file searching!
Related posts:
Mac RDP to Win 8.1 error - Remote Desktop Connection cannot verify the identity of the computer that...
How to turn on Firewall in Mac?
How to enable file sharing in Mac OS X?
How to send message to syslog server?
How to convert doc to pdf in Mac OS X
How to restart dock when dock hang in Mac OS X
CPAN Error: make test had returned bad status, won't install without force
How to delete all .svn folder in Linux / Mac?
Share this with your friends:-