PHP Classes

Class Grep Search: Search files in directories like grep

Recommend this page to a friend!
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 704 This week: 1All time: 4,669 This week: 560Up
Version License PHP version Categories
classgrepsearch 1.0GNU General Publi...5.0PHP 5, Files and Folders, Searching
Description 

Author

This class can be used to search files in directories like the Unix command grep.

It can traverse a given directory recursively and search for a given text the contents of files with a given list of file name extensions.

The path of the files that have the given text is stored in a class array variable and the class returns the number of occurrences.

The idea of the class was inspired on the Grep Simulator class written by Er. Rochak Chauhan.

Picture of Cinu Chacko
Name: Cinu Chacko <contact>
Classes: 1 package by
Country: India India
Age: 48
All time rank: 2822172 in India India
Week rank: 411 Up26 in India India Up

Details

/*******************************************/ /* File search like Unix Grep */ /* Class Name : ClassGrepSearch /* Readme */ /* Version 1.0 , GNU India */ /* Author Sampath Nannam & Cinu Chacko */ /* http://www.seraphimtech.net */ /*******************************************/ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ------------------------------------------------------------------------------------- This is a php class to simulate searching text from files in a and Online FileSystem. The Idea was taken from class ClassForGrep developed by Rochak Chauhan. All due credit to the author, but this is much more advanced. Included Files. 1)ClassGrepSearch.inc.php -->Main Class 2)exampleSearchForm.php --> Main form which starts the demo. 3)exampleSearch.php --> Called from exampleSearchForm.php which executes the commands. 4)exampleSearchCustomFunctions.php --> Customizable Functions used with the Search. 5)getFileContents.php --> Display file contents. 6)11.txt --> Alice in Wonderland full text from Gutenberg. ------------------------------------------------------------------------------------- Installation: Copy all files in a directory of your server. For search from Subdirectory to work copy contents of aliceInWonderland.zip from http://www.seraphimtech.net/repository/aliceInWonderland.zip to the directory. Start the file "exampleSearchForm.php" with your webbrowser to see a demo... thats it. ------------------------------------------------------------------------------------- FAQ: . ------------------------------------------------------------------------------------- Ask for more modules like this in the discussion forum .... http://www.seraphimtech.net

  Files folder image Files  
File Role Description
Accessible without login Plain text file 11.txt Data example text files
Plain text file ClassGrepSearch.inc.php Class Main Class
Accessible without login Plain text file exampleSearch.php Example Called from exampleSearchForm.php which executes the commands
Accessible without login Plain text file exampleSearchCustomFunctions.php Aux. Customizable Functions used with the Search.
Accessible without login Plain text file exampleSearchForm.php Example Main form which starts the demo.
Accessible without login Plain text file getFileContents.php Aux. Display file contents.
Accessible without login Plain text file readme.txt Doc. Class Documentation and License

 Version Control Unique User Downloads Download Rankings  
 0%
Total:704
This week:1
All time:4,669
This week:560Up
User Comments (1)