Topic
  • 2 replies
  • Latest Post - ‏2015-06-29T20:10:54Z by jamiedavis
osmankhalid2005
osmankhalid2005
1 Post

Pinned topic Can we search file based on contents in GPFS

‏2012-09-26T18:24:34Z |
I want to know can we search file on basis of file contents in GPFS. Is there any API available for that?
Updated on 2012-09-26T19:54:27Z at 2012-09-26T19:54:27Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2092 Posts

    Re: Can we search file based on contents in GPFS

    ‏2012-09-26T19:54:27Z  
    You don't like `find ... | xargs grep ...` ? ;-)

    mmapplypolicy lets you quickly find files by querying the attributes of files, but GPFS, AFAIK, does not come with any content based search facility.

    That would be another product, and probably applicable to most any filesystem.
  • jamiedavis
    jamiedavis
    2 Posts

    Re: Can we search file based on contents in GPFS

    ‏2015-06-29T20:10:54Z  
    You don't like `find ... | xargs grep ...` ? ;-)

    mmapplypolicy lets you quickly find files by querying the attributes of files, but GPFS, AFAIK, does not come with any content based search facility.

    That would be another product, and probably applicable to most any filesystem.

    In 4.1.1, a new sample called mmfind was made available. This is a largely-posix compliant and somewhat-GNU compliant implementation of traditional find using mmapplypolicy under the hood for parallelization. It is only available to root users due to restrictions in mmapplypolicy.

     

    It could be invoked with mmfind /fs -type f -exec <your grep command here> \; for a parallel file content search. It will return all files for which the -exec command evaluates as true.

     

    NB: the version of mmfind that shipped in 4.1.1 has an arg processign bug when it comes to flags in -exec. We are aware of the bug and it will be resolved in the next PTF. Until then a pretty simple workaround (if you know perl) is to tweak the GetOptions call in mmfind and tr_findToPol to remove whichever shorthand arg is being confused with your -exec args. For example, the -i in -exec grep -i catdog {} \; will be consumed by GetOptions, resulting in -exec grep catdog {} \; instead.