{"id":19329048,"url":"https://github.com/ncornette/greptile","last_synced_at":"2025-10-10T22:48:35.399Z","repository":{"id":57436003,"uuid":"57029669","full_name":"ncornette/greptile","owner":"ncornette","description":"Fast grep implementation in python, with recursive search and replace","archived":false,"fork":false,"pushed_at":"2018-09-18T15:58:00.000Z","size":18,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-17T17:56:05.091Z","etag":null,"topics":["fast","grep","python","recursive","regex","replace-in-files","search"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ncornette.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-25T09:33:58.000Z","updated_at":"2024-04-09T07:07:01.000Z","dependencies_parsed_at":"2022-09-01T16:04:09.623Z","dependency_job_id":null,"html_url":"https://github.com/ncornette/greptile","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ncornette/greptile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncornette%2Fgreptile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncornette%2Fgreptile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncornette%2Fgreptile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncornette%2Fgreptile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ncornette","download_url":"https://codeload.github.com/ncornette/greptile/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncornette%2Fgreptile/sbom","scorecard":{"id":677488,"data":{"date":"2025-08-11","repo":{"name":"github.com/ncornette/greptile","commit":"d302663aa41afbf0d6a85154517c0ea796170113"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU Lesser General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T21:58:02.403Z","repository_id":57436003,"created_at":"2025-08-21T21:58:02.403Z","updated_at":"2025-08-21T21:58:02.403Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005460,"owners_count":26083902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fast","grep","python","recursive","regex","replace-in-files","search"],"created_at":"2024-11-10T02:26:19.004Z","updated_at":"2025-10-10T22:48:35.381Z","avatar_url":"https://github.com/ncornette.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/ncornette/greptile.svg?branch=master)](https://travis-ci.org/ncornette/greptile) \n[![Codacy Badge](https://api.codacy.com/project/badge/grade/a046f045b39a419b9f31ff1fb324d9a8)](https://www.codacy.com/app/nicolas-cornette/greptile)\n[![codecov](https://codecov.io/gh/ncornette/greptile/branch/master/graph/badge.svg)](https://codecov.io/gh/ncornette/greptile)\n[![PyPI](https://img.shields.io/pypi/v/greptile.svg?maxAge=2592000)](https://pypi.python.org/pypi/Greptile)\n\n# Greptile\nFast grep implementation in python, with replace features\n\n```\nusage: greptile.py [-h] [-v] [-x EXTENSIONS [EXTENSIONS ...]] [-r] [-l] [-i]\n                   [-g REPLACE_EXPR] [-f REPLACE_EXPR]\n                   expression [file]\n\nfile search and replace with regular expressions\n\npositional arguments:\n  expression            regular expression\n  file                  file path (or directory if -r is used)\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -v, --version         show program's version number and exit\n  -x EXTENSIONS [EXTENSIONS ...], --extensions EXTENSIONS [EXTENSIONS ...]\n                        restrict search to file extensions (ex: .py .txt .java\n                        .xml)\n  -r, --recursive       recursively search in path\n  -l, --list            list files matching pattern\n  -i, --inplace         update the file inplace (with -g or -f)\n  -g REPLACE_EXPR, --replace-global REPLACE_EXPR\n                        global replacement expression\n  -f REPLACE_EXPR, --replace-first REPLACE_EXPR\n                        first occurrence replacement expression\n```\n\n### Why fast?\n\nBecause it exclusively uses generators, reptile never allocates big lists, it always processes one line in one file at a time. you can do a search on big files and large directories like `/` recursively without memory overhead.\n\n### Examples: \n\n#### Search `\"import\"` in ./greptile.py :\n```bash\n$ ./greptile.py \"import\" ./greptile.py\n```\n```bash\nimport re\nimport os\nimport sys\n    import argparse\n```\n\n#### Recursively search from `~/` lines in python files containing `Copyright` :\n```bash\n$ ./greptile.py -x .py -r \"Copyright\" ~/\n```\n```bash\n/Users/nic/Library/Android/sdk/platform-tools/systrace/systrace-legacy.py 2:  # Copyright (c) 2011 The Chromium Authors. All rights reserved.\n/Users/nic/Library/Android/sdk/platform-tools/systrace/systrace.py 2:  # Copyright (c) 2011 The Chromium Authors. All rights reserved.\n/Users/nic/Library/Android/sdk/platform-tools/systrace/systrace_agent.py 0:  # Copyright (c) 2015 The Chromium Authors. All rights reserved.\n/Users/nic/Library/Android/sdk/platform-tools/systrace/util.py 0:  # Copyright (c) 2015 The Chromium Authors. All rights reserved.\n/Users/nic/Library/Android/sdk/platform-tools/systrace/agents/__init__.py 0:  # Copyright (c) 2015 The Chromium Authors. All rights reserved.\n/Users/nic/Library/Android/sdk/platform-tools/systrace/agents/atrace_agent.py 0:  # Copyright (c) 2015 The Chromium Authors. All rights reserved.\n...\n```\n\n#### Replacement \u0026 easy grouping with python `re.sub` syntax :\n```bash\n$ greptile.py \"\\[(.*)\\]\\((.*)\\)\" README.md -g \"\u003ca href=\\\"\\2\\\"\u003e\\1\u003c/a\u003e\" | diff -u README.md -\n```\n```diff\n--- README.md\t2016-04-19 22:37:20.000000000 +0200\n+++ -\t2016-04-25 14:54:24.000000000 +0200\n@@ -1,4 +1,4 @@\n-![Agera](https://github.com/google/agera/blob/master/doc/images/agera.png)\n+!\u003ca href=\"https://github.com/google/agera/blob/master/doc/images/agera.png\"\u003eAgera\u003c/a\u003e\n Reactive Programming for Android\n ================================\n\n```\n### Api: \n\n```python\nimport greptile\n\n# Replace \"import\" by \"export\" from dir `./`, in all files and these extensions: .py, .xml, .java\ngreptile.replace('import', 'export', './', '.py', '.xml', '.java')\n\n# Return filenames of all files containing the text \"import\" from dir `./` and .py, .xml, .java\nmy_list = greptile.grep_rl('import', './', '.py', '.xml', '.java')\n\n# same as calling replace()\ngreptile.sed_i(my_list, 'import', 'export')\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncornette%2Fgreptile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fncornette%2Fgreptile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncornette%2Fgreptile/lists"}