Skip to content

A simple Python-written command line tool to search for files and file contents using (Python) regex patterns.

License

Notifications You must be signed in to change notification settings

michael-koller-91/filesearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filesearch

A command line tool written in Python to find files and file contents matching (Python) regex patterns.

Example usage

Print the usage help:

filesearch

Find all files ending with .py:

filesearch ".*.py\b"

Find all files ending with .py but exclude files in the folder .git:

filesearch ".*.py\b" ".git"

In all files ending with .py but excluding files in the folder .git, find lines containing def:

filesearch ".*.py\b" ".git" "def"

In the previous example, also print the 3 lines before and after the matching line

filesearch ".*.py\b" ".git" "def" 3

Installation

Option 1 (recommended): Install as standalone command line tool

If you want to be able to run filesearch from anywhere in the terminal, you can use the following two commands. First, create a source distribution with

python setup.py sdist

Second, use pipx to install and be able to run the application in an isolated environment:

python -m pipx install .

This requires pipx to be installed (e.g., via python -m pip install pipx).

Option 2: No installation

If you only want to use main.py, no packages need to be installed. Navigate to filesearch/ and use

python main.py --help

to get instructions on how to use the tool.

About

A simple Python-written command line tool to search for files and file contents using (Python) regex patterns.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages