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:-
1find ./ -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:-
12# 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
1find #path# -name "*.#file_extension#" -print | xargs grep "#content_you_want_to_find#"
Happy file searching!
Related posts:
How to create symbolic link in Unix
How to use apt to list available packages?
How to flush DNS cache in Linux / Windows / Mac
How to batch resize image in Mac OS X
CentOS: install yum fastest mirror plugin for faster connection update
How to create shortcut in Mac OS X
Debian: "There is no public key available for the following key IDs"
CentOS 7: How to setup TUI Firewall settings?
Share this with your friends:-