Package: pyf-programmers-find
It’s pronounced “pif”.pyf[options][search-pattern[filename-pattern[start-directory]]]Recursively search for files whose contents matches search-pattern.Optionally restrict the search to files whose name matches
filename-pattern.Optionally chdir to start-directory before starting the search.Patterns are Python regular expressions.Written because I got tired of writing:find.-name'*.py'-execegrep-lregex{}\;The above with pyf would be:pyfregex'\.py$'orpyfregex'py$'or justpyfregexpyIf you don’t pass in a regex as the file name pattern, pyf assumes it is
a file extension match and adds a $ on the end.File name patterns and the search patterns inside of files are bothPython regular
expressions.ExamplesFind Files Containing A RegexpyfregexThe above example will recursively find files and search for ‘regex’ in
the file.Restrict The Search To Certain File ExtensionspyfregexpyThe above example will recursively find files whose name ends in ‘py’
and search for ‘regex’ in the file.Finding Files Which Contain One Thing But Not Anotherpyfposthtml|pyf-v-f-csrf_tokenAbove finds all files whose name ends in ‘html’ and contain ‘post’ but
do not contain ‘csrf_token’.Running A Command On A Matched Filepyf-r"sed -i '' -e 's/yajogo\.core\.debug/yajogo.core.logging/g'"'yajogo\.core\.debug'pyAbove finds files with extention ‘py’ that contain the string
‘yajogo.core.debug’ and runs a sed command on them.Printing Regex Matchespyf-s-m'\d+x\d+'htmlAbove will print all matches of the pattern ‘+x+’ in files whose names
ends in ‘html’. The -s option suppresses printing of the filename for
the match. The -m option causes the matched regex to be printed. So,
with the above you might get an output like this:57x57
72x72
114x114
512x512
200x200
150x150
150x150
150x150
500x500
800x600
150x150
150x150We could pipe the output of this command to another program. For
example:pyf-s-mhtml'(\d+x\d+)'|sort|uniqWould give us a sorted and unique list of matches:114x114
150x150
200x200
500x500
512x512
57x57
72x72
800x600Installationpipinstallpyf-programmers-findUsage$pyf-husage:pyf[options][search-pattern[filename-pattern[start-directory]]]pyf:programmersfindRecursivelysearchforfileswhosecontentsmatchessearch-pattern.Optionallyrestrictthesearchtofileswhosenamematchesfilename-pattern.PatternsarePythonregularexpressions.It's pronounced "pif".

positional arguments:
  search-pattern        Match this pattern in files.
  filename-pattern      Only search files whose name matches this pattern.
  start-directory       Change to this directory before findind and searching
                        files.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program'sversionnumberandexit--debugTurnondebuglogging.--debug-logFILESavedebugloggingtoFILE.-cCOUNT,--contextCOUNTShowCOUNTsurroundingcontextlinesofthematches.Onlymakessensewhenprintingmatchedlineswiththe-poption.Default0.-dSTART_DIRECTORY,--chdirSTART_DIRECTORYChangetodirectorySTART_DIRECTORYbeforestartingthesearch.Canalsobegivenasthethirdpositionalargument.-eSEARCH_PATTERN,--regexpSEARCH_PATTERNUseSEARCH_PATTERNasthepatterntomatchinafile;usewhendefiningpatternsbeginningwith-.Canalsobegivenasthefirstpositionalargument.-fFILE,--fileFILEFiletosearchforamatch.Insteadofrecursivelysearchingallfiles.Canbegivenmultipletimes.Ifargumentis-readsalistoffilestomatchfromstdin.-i,--ignore-caseIgnorecase.DefaultFalse.-l,--line-numberPrintthematchinglinenumber.DefaultFalse.-m,--matchesPrintthematchingregexgroup.DefaultFalse.-nFILENAME_PATTERN,--filenameFILENAME_PATTERNRecursivelyfindfileswhosenamematchesFILENAME_PATTERN.Onlysearchinthosefiles.Canalsobegivenasthesecondpositionalargument.Default:.+-p,--print-linesPrintthematchingline.DefaultFalse.-rCMD,--runCMDRunaprogramCMDforeachmatchingfile,passingthepathnameofthematchingfileasanargument.Ignoredifthe-por-loptionsaregiven.-s,--no-filenameDonotprintthefilenamewhenprintingmatchedlines.Onlymakessensewiththe-poption.DefaultFalse.-v,--invert-matchInvertthesenseofthematch.Printnon-matchingfilesandlines.DefaultFalse.-A,--suppress-file-access-errorsDonotprintfile/directoryaccesserrors.-B,--no-binary-checkIgnore(heuristic)binaryfilecheck,donotskipprobablybinaryfiles.-N,--no-pagerDonotpipeoutputtoapagerwhenstdoutitdetectedasatty.--force-pagerAlwaystrytopipeoutputtoapager,donotcheckifstdoutisatty.Ignoredwhenrunningwiththe-roption.--skip-dirs-patternSKIP_DIRS_PATTERNRegexofdirectoriestoskip.Default'(^\..+|CVS|RCS|__pycache__)'.--skip-files-patternSKIP_FILES_PATTERNRegexoffilestoskip.Default'(^\..+|\.pyc$)'.