Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

The power of GREP


Recommended Posts

For those of you searching for certain strings of letters and or numbers I suggest becoming familar with the "GREP" command. Although you can only use this at the command line under linux it is invaluable tool to assist you in customizing your store. If you need a way to access your server via command line I suggest getting a copy of Putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/


There are many sites with tutorials (search for grep on google) so I will not attempt to rebuild the wheel so to speak but rather give you a quick example.






grep -rn 'keywords' *


The option "r" is for recursive so we search through all directories under catalog.

The option "n" will display the line number of where the string was found in the file.

The search criteria are contained within the single quotes.

The option "*" will search all files from catalog and down for the string "keywords"


Output will look like (shortened output):

includes/languages/english/advanced_search.php:57:define('ERROR_INVALID_KEYWORDS', 'Invalid keywords.');

includes/languages/english.php:91:define('BOX_SEARCH_TEXT', 'Use keywords to find the product you are looking for.');


As you can see this simple but extremely powerful tool :)

Hope someone finds this useful :D

Link to comment
Share on other sites

The find tool in Dreamweaver MX 2004 is a great tool alos. It can search a 'site' (defined folder that conains all contents for a particular project) and can even run a replace command on all the files in the site automatically.


I like this the best...personally.



Chris Sullivan

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...