{"id":26010558,"url":"https://github.com/jdonszelmann/d-rs","last_synced_at":"2025-10-07T03:39:08.387Z","repository":{"id":114826361,"uuid":"499566114","full_name":"jdonszelmann/d-rs","owner":"jdonszelmann","description":"grep + sed + awk ++","archived":false,"fork":false,"pushed_at":"2023-05-31T10:57:27.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T22:48:01.718Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdonszelmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-03T15:45:22.000Z","updated_at":"2022-06-07T13:14:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"09eafd98-96e9-4e92-bc5d-b0c1aeeea8bf","html_url":"https://github.com/jdonszelmann/d-rs","commit_stats":null,"previous_names":["jdonszelmann/d-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jdonszelmann/d-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fd-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fd-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fd-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fd-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdonszelmann","download_url":"https://codeload.github.com/jdonszelmann/d-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdonszelmann%2Fd-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717080,"owners_count":26033535,"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-07T02:00:06.786Z","response_time":59,"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":[],"created_at":"2025-03-05T22:51:14.841Z","updated_at":"2025-10-07T03:39:08.382Z","avatar_url":"https://github.com/jdonszelmann.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n`d` stands for `data`. `d-rs` is a combination of features from grep, awk\nsed, and other unix tools, to easily edit piped data.\n\n## How to use\n\nLet's say a file exists with the following contents:\n\n```\n# Hours\n\nx: 3 hours\ny: 3.5 hours\nz: 15 hours\nw: 1.5 hours\n```\n\nYou can use d to find how many hours there are in total with:\n\n```\ncat hours.txt | d f float | d r sum\n```\nGives 23.\n\nSo what happened here?\n\nd has 4 main subcommands\n* filter (or find, it's pretty much the same operation for d)\n* map\n* reduce\n* split\n\nEach of the commands can be abbreviated (by `f`, `m`, `r` or `s` respectively).\n\nSo what happened in the example? first we `f`ind all the floats, then we `r`educe\nusing the `sum` operator.\n\nIn general, you can \n* find things using custom or a number of built-in regexes\n* map things using custom or a number of built-in regexes, or a python expression (more may come)\n* reduce things using the sum, product or join operators (more may come)\n* split things based on a single character or word (no regexes supported yet)\n\n## python mapping\n\nusing `d m p` (d map python) you can tell d to run a line of python\nfor every line in the input. Your line will be ran in a context where:\n* There is an `i` or `inp` variable available which contains the current line\n* There is an `o` or `out` variable which when written to becomes the result of the expression (using `__repr__` to convert it to a string)\n* Alternatively, you can print the result of your expression. If you do, the values in `o`/`out` are ignored, to prevent multiple outputs from the expression.\n\nNo state is kept between mapping lines.\n\n# TODO list\n* more built-in regexes\n* finding commonly used units (for example, disk sizes in the format `500KiB`) and automatically convert to their base units (`500Kib` --\u003e `512000`)\n* built-in n-to-m base conversion\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdonszelmann%2Fd-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdonszelmann%2Fd-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdonszelmann%2Fd-rs/lists"}