PHP Classes

Class Grep Search: Search files in directories like grep

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 705 All time: 4,666 This week: 75Up
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: 49
All time rank: 2826173 in India India
Week rank: 187 Up15 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 (7)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:705
This week:0
All time:4,666
This week:75Up
User Comments (1)