SCRIPT DE RECHERCHE DE FICHIERS

Auteur: Ludovic MARTIN


Description

Ce script recherche tous les fichiers contenant un motif dans un répertoire et ses sous-répertoires.

Il s'appuie sur les commandes find et grep.

Les avantages par rapport à ces commandes sont:

Les inconvénients sont:


Installation


Utilisation

Il faut obligatoirement passer un motif en paramètre au script. Ce motif doit être mis entre guillemets s'il contient des espaces ou des symboles suceptibles d'être interprétés par le shell (par ex, '*')

Les autres paramètres sont le réperoire racine de la recherche et le nom des fichiers à considérer.
Ils ne sont pas obligatoires. En cas d'absence, la recherche se fait à partir du répertoire courant sur tous les fichiers lisibles.
Ils doivent être mis avant le motif et après les options. Leur place relative n'a pas d'importance.

[martin@venus pdp]$ rechFich src/ "*.cpp" sendConfig
Recherche des fichiers "*.cpp" contenant "sendConfig" a partir de "src/"
src/jGripnewService.cpp
274:int jGripnewService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
src/jManager.cpp
786:            return l_service->sendConfig((const COPSReqMsg *)_msg, thCallBack);
910:bool jManager::sendConfigIpsec(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
915:bool jManager::sendConfigDiffserv(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
src/jQosService.cpp
268:int jQosService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
src/jSecurityService.cpp
711:int jSecurityService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
src/jSecurityTrapService.cpp
277:int jSecurityTrapService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
src/lContentAdaptationService.cpp
462:int lContentAdaptationService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
466:  MLOG(className, "sendConfig","LM Debut", lgDebug, 2); // LM DEBUG
529:    MLOG(className, "sendConfig","LM Fin", lgDebug, 2); // LM DEBUG

[martin@venus pdp]$ rechFich -v "*.cpp" src/ sendConfig
Recherche des fichiers "*.cpp" contenant "sendConfig" a partir de "src/"
-rw-r--r--    1 martin   users       13678 Jun  9 16:41 src/jGripnewService.cpp
274:int jGripnewService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
-rw-r--r--    1 martin   users       41438 Jun 10 12:38 src/jManager.cpp
786:            return l_service->sendConfig((const COPSReqMsg *)_msg, thCallBack);
910:bool jManager::sendConfigIpsec(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
915:bool jManager::sendConfigDiffserv(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
-rw-r--r--    1 martin   users       11868 Jun  9 16:41 src/jQosService.cpp
268:int jQosService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
-rw-r--r--    1 martin   users       35871 Jun  9 16:44 src/jSecurityService.cpp
711:int jSecurityService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
-rw-r--r--    1 martin   users       16223 Jun  9 16:44 src/jSecurityTrapService.cpp
277:int jSecurityTrapService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
-rw-r--r--    1 martin   users       21788 Jun 16 09:22 src/lContentAdaptationService.cpp
462:int lContentAdaptationService::sendConfig(const COPSReqMsg *reqMsg, jThreadPEP * thCallBack)
466:  MLOG(className, "sendConfig","LM Debut", lgDebug, 2); // LM DEBUG
529:    MLOG(className, "sendConfig","LM Fin", lgDebug, 2); // LM DEBUG

[martin@venus pdp]$ rechFich -s src/ sendConfig
Recherche des fichiers contenant "sendConfig" a partir de "src/"
src/jGripnewService.cpp
src/jGripnewService.h
src/jManager.cpp
src/jManager.h
src/jPolicyService.h
src/jQosService.cpp
src/jQosService.h
src/jSecurityService.cpp
src/jSecurityService.h
src/jSecurityTrapService.cpp
src/jSecurityTrapService.h
src/#jManager.cpp#
src/jManager.cpp~
src/lContentAdaptationService.cpp
src/lContentAdaptationService.h
src/lContentAdaptationService.h~
src/#lContentAdaptationService.cpp#
src/lContentAdaptationService.cpp~
src/#lContentAdaptationService.h#