Skip to main content

Simple CLI application for searching keywords/phrases or regular expression patterns from text files.

Project description

find-from-files

Simple CLI application for searching keywords/phrases or regular expression patterns from text files.

Usage

usage: find-from-files [-h] [-l] [-r] [-s [SUFFIX ...]] [-S [SKIP ...]] [-a]
  [-q] [-qq] base_directory search_string

This script can be useful, e.g., for analyzing log files. When used without the
--regex flag, it traverses through directories starting from the
<base_directory> and prints the name of the file containing <search_string> and
the line that it is on. This is handy if you want to quickly find the files
that contain the string you are looking for. When used with the --regex flag,
it searches for the <search_string> with Python regular expression function
re.findall() in the files, and prints a summary containing the matches and
their number. This allows you to search for all occurrences of a pattern in
files. If the --whole-line flag is used, the whole line is printed instead of
just the match (does nothing without the --regex flag).

positional arguments:
  base_directory        Base directory to start the search from.
  search_string         String/regex to search for.

options:
  -h, --help            show this help message and exit
  -l, --whole-line      Search for the whole line containing the search string.
                        Only works with the --regexp flag.
  -r, --regexp          Search using regular expression.
  -s, --suffix [SUFFIX ...]
                        File suffix to search for. Files without this suffix
                        will be skipped.
  -S, --skip [SKIP ...]
                        Skip folders that start with this prefix.
  -a, --no-ansi         Do not use ANSI codes for output. Redirections never
                        contain ANSI codes.
  -q, --quiet           Do not print skipped folders or files.
  -qq, --quieter        Do not print skipped folders or files, and only print
                        the files that contain the search string/pattern.
  -V, --version         show program's version number and exit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

find_from_files-1.0.2.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

find_from_files-1.0.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file find_from_files-1.0.2.tar.gz.

File metadata

  • Download URL: find_from_files-1.0.2.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.2 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for find_from_files-1.0.2.tar.gz
Algorithm Hash digest
SHA256 86d8f9ec27d30c5b436fd4f91fe1368ccf8aa5584bd787c621e16fd2e57ceffe
MD5 b18edee43230c7b74ce2452bd41161f6
BLAKE2b-256 6e1ca4b2fba95962a509dfdb26e2ecc29f1551e55fc481f1638523790124cff7

See more details on using hashes here.

File details

Details for the file find_from_files-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: find_from_files-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.2 Linux/5.15.167.4-microsoft-standard-WSL2

File hashes

Hashes for find_from_files-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2ef67a89274ad8ce5ac38281e7aa4ec2494103a737676eeff0066a32a2b8c308
MD5 fac8bb39fb14d4103020937115869f2b
BLAKE2b-256 6784bbd6f1d7c6cf7b586f11062c7f68238b21c567d3a5fcca3e912d3ad5d0be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page