{"id":34842970,"url":"https://github.com/selectiveduplicate/grab","last_synced_at":"2026-04-11T15:36:57.583Z","repository":{"id":53865550,"uuid":"380564589","full_name":"selectiveduplicate/grab","owner":"selectiveduplicate","description":"An attempt at making a simple clone of grep(1) using Rust.","archived":false,"fork":false,"pushed_at":"2023-08-19T05:46:09.000Z","size":79,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T02:27:07.382Z","etag":null,"topics":["cli","command-line","grep","grep-like","linux","rust","rustlang","shell","terminal","unix"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selectiveduplicate.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":"2021-06-26T17:52:00.000Z","updated_at":"2025-09-21T15:39:42.000Z","dependencies_parsed_at":"2022-08-28T06:30:59.787Z","dependency_job_id":null,"html_url":"https://github.com/selectiveduplicate/grab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/selectiveduplicate/grab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectiveduplicate%2Fgrab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectiveduplicate%2Fgrab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectiveduplicate%2Fgrab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectiveduplicate%2Fgrab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selectiveduplicate","download_url":"https://codeload.github.com/selectiveduplicate/grab/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectiveduplicate%2Fgrab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31686140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","command-line","grep","grep-like","linux","rust","rustlang","shell","terminal","unix"],"created_at":"2025-12-25T17:17:48.639Z","updated_at":"2026-04-11T15:36:57.576Z","avatar_url":"https://github.com/selectiveduplicate.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![justforfunnoreally.dev badge](https://img.shields.io/badge/justforfunnoreally-dev-9ff)](https://justforfunnoreally.dev)\n\nAn attempt at making a simple clone of [grep(1)](https://www.man7.org/linux/man-pages/man1/grep.1.html) using Rust.\n\nIt builds up on the [lightweight grep-like program](https://github.com/rust-in-action/code/blob/7d7955e9605ca156f6eb7cb5bc9f124c97927d25/ch2/ch2-with-regex.rs) presented in the book [Rust in Action](https://www.manning.com/books/rust-in-action) by Tim McNamara.\n\n# Installation\nIf you don't have Rust installed, follow [the official instructions](https://www.rust-lang.org/tools/install) to install Rust. Then:\n\n* Clone the repo.\n* Go to the project directory.\n* Run `cargo install --path .` from your terminal. It'll install the binary in your `$HOME/.cargo/bin` directory.\n* Alternatively, you can run `cargo build --release` or `cargo build` to just build the project.\n\n# Usage\nTo see available usages, supply the  `--help` flag to your `grab` executable:\n\n```shell\ngrab --help\n```\n\n## Usage examples\n* The following searches for the words `Like` or `like`, using the `--ignore-case` flag:\n\n```shell\ngrab \"like\" --ignore-case src/data/pessoa.txt\n```\n\nIt'll output the following text (you can also specify the `--color` flag to colorize the matches):\n\n```\nLike someone on a hill who tries to make out the people in the\ndistresses me like a letter of farewell. I feel as if I’m always on the\ngroup of my sensations to another, like drifting clouds that make the\nI’m like someone searching at random, not knowing what object he’s\nlandscape, sorrows like closed rooms, certain voices, a huge weariness,\nthere are other people with a soul like our own. My vanity consists of\n```\n\n* You can also provide regular expressions instead of just words. For example, the following outputs every line containing 2-letter words:\n\n```shell\ngrab --color \"\\b[a-zA-Z]{2}\\b\" src/data/pessoa.txt\n```\n\n* You can print context lines by using the following options, followed by the number of context lines you want:\n\t* `--after-context`, `-A`\n\t* `--before-context`, `-B`\n\t* `--context`, `-C`\n\nFor example, the following prints two context lines before and after each matching line:\n\n```shell\ngrab \"like\" -C 2 src/data/pessoa.txt\n```\nThis yields the following, with the default separator `---` between each group of match and context:\n\n```\nIn these times when an abyss opens up in my soul, the tiniest detail\ndistresses me like a letter of farewell. I feel as if I’m always on the\nverge of waking up. I’m oppressed by the very self that encases me,\nasphyxiated by conclusions, and I’d gladly scream if my voice could\n---\nasphyxiated by conclusions, and I’d gladly scream if my voice could\nreach somewhere. But there’s this heavy slumber that moves from one\ngroup of my sensations to another, like drifting clouds that make the\nhalf-shaded grass of sprawling fields turn various colours of sun and\ngreen.\n---\ngreen.\n\nI’m like someone searching at random, not knowing what object he’s\nlooking for nor where it was hidden. We play hide-and-seek with no\none. There’s a transcendent trick in all of this, a fluid divinity we can\n---\nYes, I reread these pages that represent worthless hours, brief\nillusions or moments of calm, large hopes channelled into the\nlandscape, sorrows like closed rooms, certain voices, a huge weariness,\nthe unwritten gospel.\n\n---\n```\nYou can use a custom separator by using the `--group-separator` option.\n\nYou might've already noticed a difference between `grep` and `grab` for context lines. `grep` will never show you a line more than once, `grab` does.\n\n# Features\n - [x] `STDIN` mode\n - [x] Colored matches\n - [x] Number of matches\n - [x] Invert matching\n - [x] Case insensitive mode\n - [x] Line numbers\n - [x] Context lines\n\t - [x] Trailing context\n\t - [x] Leading context\n\t - [x] Both trailing and leading context\n- [x]  Custom group separator\n\t- [x] Colored separator\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselectiveduplicate%2Fgrab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselectiveduplicate%2Fgrab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselectiveduplicate%2Fgrab/lists"}