{"id":18374942,"url":"https://github.com/grieferatwork/sreplace","last_synced_at":"2025-08-09T22:05:15.770Z","repository":{"id":115114837,"uuid":"483391902","full_name":"GrieferAtWork/sreplace","owner":"GrieferAtWork","description":"StringREPLACE","archived":false,"fork":false,"pushed_at":"2022-04-21T10:14:25.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T03:59:01.292Z","etag":null,"topics":["command-line-tool","command-line-utility","find","regex","regex-match","replace","replace-text"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GrieferAtWork.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-04-19T20:01:32.000Z","updated_at":"2022-04-19T20:08:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3b0df20-cfdd-4621-a231-865ff57f7ce1","html_url":"https://github.com/GrieferAtWork/sreplace","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GrieferAtWork/sreplace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrieferAtWork%2Fsreplace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrieferAtWork%2Fsreplace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrieferAtWork%2Fsreplace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrieferAtWork%2Fsreplace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrieferAtWork","download_url":"https://codeload.github.com/GrieferAtWork/sreplace/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrieferAtWork%2Fsreplace/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269644293,"owners_count":24452539,"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-08-09T02:00:10.424Z","response_time":111,"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":["command-line-tool","command-line-utility","find","regex","regex-match","replace","replace-text"],"created_at":"2024-11-06T00:16:45.647Z","updated_at":"2025-08-09T22:05:15.757Z","avatar_url":"https://github.com/GrieferAtWork.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sreplace\n\nStringREPLACE: a simple commandline utility for mass finding+replacing strings/words in text files.\n\n\n\n### Building\n\nsreplace can be built for both windows and unix system.\n\n- Windows: Open `sreplace.sln` with Visual Studio and press `CTRL+SHIFT+B`\n\n- Unix/GCC:\n\n  ```sh\n  gcc -o sreplace main.c\n  ```\n\nKnown working target systems: `windows`, `cygwin`, `linux`, `KOS`\n\n### Usage\n\nThe general idea behind `sreplace` is to specify FIND+REPLACE pairs, as well as a list of files/directories to search for FIND patterns that are then replaced. To prevent ambiguity, you should always invoke the utility as `sreplace -ibet -- FIND1 REPLACE1 FIND2 REPLACE2 -- file.txt`.\n\nFlags:\n\n- `-f`, `--find`: Instead of FIND+REPLACE pairs, all commandline strings are FIND, and rather than replace anything, print all matching locations as `file:line:col:nchars:pattern\\n`\n- `-i`, `--icase`: Ignore casing\n- `-b`, `--bound`: Only match whole word (independently of`--regex`)\n- `-r`, `--regex`: `FIND` patterns are regular expressions\n\t- NOTE: Currently only available on UNIX.\n- `-e`, `--escape`: `FIND` and `REPLACE` undergo C-style control character expansion before being used\n- `-t`, `--keep-mtime`: Preserve last-modified timestamps of modified files\n- `-R`, `--recursive`: Accept directories in the list of files. Directories will be enumerated recursively, and all contained files are treated as if they were listed explicitly (but see `--ext=LIST`).\n- `--ext=LIST`: Only scan files with extensions apart of `LIST` when they are encountered as the result of scanning a directory due to `-R` (example: `--ext=.txt:.c:.h` -- only find+replace `.txt`, `.c` and `.h` files)\n- `-n N`, `--max=N`: Stop after N matches\n\n\n### Examples\n\nHere are some examples:\n\n- Replace data in streams\n\n  ```sh\n  $ echo Hello Wrold | sreplace -- Wrold World\n  Hello World\n  ```\n\n- Inplace-modify files\n\n  ```sh\n  $ echo foo bar foobar \u003e file\n  $ sreplace -b -- bar baz -- file\n  $ cat file\n  foo baz foobar\n  ```\n\n- Find occurances\n\n  ```sh\n  $ echo foo bar foobar \u003e file\n  $ echo bar foo foobar \u003e\u003e file\n  $ sreplace -fb -- foo bar -- file\n  file:1:1:3:foo\n  file:1:5:3:bar\n  file:2:1:3:bar\n  file:2:5:3:foo\n  ```\n\n- Replace non-printable characters (including `\\0` NUL)\n\n  ```sh\n  $ echo -e 'a\\0b\\0c\\0d\\0e' | sreplace -e -- '\\0' '_'\n  a_b_c_d_e\n  ```\n\n- Count occurances\n\n  ```sh\n  $ sreplace -fb -- opt_progname -- main.c | wc -l\n  4\n  ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrieferatwork%2Fsreplace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrieferatwork%2Fsreplace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrieferatwork%2Fsreplace/lists"}