ruplacer is a command-line utility for finding and replacing text across source files. It searches directories recursively and displays the differences that would result from a replacement before making changes.
The application is designed for editing collections of source files without accidentally modifying unrelated content. It follows .gitignore rules when walking directories and skips binary files and text containing invalid UTF-8 data.
One of ruplacer’s distinctive capabilities is case-preserving replacement. For example, it can replace a name while preserving different capitalisation and naming conventions, including snake_case and CamelCase. This is useful when renaming identifiers that appear in several forms throughout a project.
This is free and open source software.
Key Features
- Find and replace text recursively within a specified directory.
- Search the current working directory when no path is supplied.
- Display a diff of proposed changes before modifying files.
- Write replacements to disk using –go.
- Use regular expressions for matching text.
- Reference captured groups in replacement strings using $1, $2 and similar syntax.
- Disable regular-expression interpretation using –no-regex.
- Preserve capitalisation and naming conventions using –preserve-case.
- Recognise lower-case, upper-case, snake_case and CamelCase forms.
- Respect .gitignore rules while traversing directories.
- Skip binary files and files containing invalid UTF-8 text.
- Include or exclude files using glob patterns.
- Filter files by recognised types such as C++ or JavaScript.
- List recognised file types using –type-list.
- Control whether hidden and ignored files are processed.
- Use quiet output when detailed progress messages are not needed.
- Cross-platform support – runs on Linux, macOS, and Windows.
Website: codeberg.org/your-tools/ruplacer
Support:
Developer: Dimitri Merejkowsky
License: BSD 3-Clause ‘New’ or ‘Revised’ License

Examples:
Replace ‘foo’ with ‘bar’:
$ ruplacer foo bar
Replace ‘LastName, FirstName’ with ‘FirstName LastName’:
$ ruplacer '(\w+), (\w+)' '$2 $1'
Replace ‘--foo-bar‘ with ‘–spam-eggs’. The use of ‘--‘ because the pattern and the replacement start with two dashes:
$ ruplacer -- --foo-bar --spam-eggs
Replace ‘FooBar’ with ‘SpamEggs’, ‘foo_bar’ with ‘spam_eggs’, …
$ ruplacer --subvert FooBar SpamEggs
ruplacer is written in Rust. Learn Rust with our recommended free books and free tutorials.
Related Software
| Alternatives to sed | |
|---|---|
| sad | Space Age seD |
| sd | Intuitive find and replace CLI |
| Sed-Go | Implementation of sed in Go |
| ruplacer | Find and replace text in source files |
| ripgrep | Recursively search directories for a regex pattern |
| amber | Code search and replace tool |
| rep | Perform find and replace on grep-formatted lines |
| repgrep | Interactive replacer for ripgrep |
| srgn | Code surgeon for searching and manipulating text and source code |
| teip | Masking tape to help commands "do one thing well" |
| Alternatives to awk | |
|---|---|
| gawk | Implementation of the awk programming language |
| GoAWK | POSIX-compliant awk interpreter written in Go |
| Miller | Small and powerful CLI tool to do all your data processing |
| frawk | Small programming language for writing short programs processing textual data |
| choose | Human-friendly and fast alternative to cut and (sometimes) awk |
| gema | General purpose text processing utility based on the concept of pattern matching |
| mawk | Interpreter for the awk programming language |
| ruplacer | Find and replace text in source files |
| rawk | POSIX compatible AWK written in Rust |
| wak | awk implementation for toybox and standalone |
| PAWK | Python line processor |
| Hawk | Haskell text processor for the command-line |
| Alternatives to grep | |
|---|---|
| ugrep | Ultra fast grep with interactive - Top 100 TUI apps |
| ripgrep | Recursively search directories for a regex pattern - Top 100 CLI apps |
| sift | Fast and powerful alternative to grep |
| The Silver Searcher | Code-searching tool similar to ack, but faster |
| ack | grep-like source code search tool |
| CGrep | Context-aware grep for source codes |
| ngrep | grep applied to the network layer |
| vgrep | Pager for grep, git-grep, ripgrep and similar grep implementations |
| xlsxgrep | Tool to search text in XLSX, XLS, CSV, TSV and ODS files |
| bingrep | grep-like tool for binaries |
| ucg | grep-like tool specialized for searching large bodies of source code |
| pru | Pipeable Ruby |
| phpgrep | Syntax-aware grep for PHP code |
| rzgrep | grep for stuff in archives that are embedded within archives |
| skim | General-purpose fuzzy finder |
| ruplacer | Find and replace text in source files |
| Clapgrep | GUI tool which offers ripgrep based full-text searches |
| repgrep | Interactive replacer for ripgrep |
| w2vgrep | Semantic grep tool |
| ast-grep | Performs structural search, lint and rewriting |
| serpl | TUI to search and replace keywords |
| grok | Tool like UNIX grep on steroids |
| osgrep | Natural-language search that works like grep |
| hgrep | grep with human-friendly search output |
| mgrep | Semantically grep everything |
| demongrep | Fast, local semantic code search |
| ck | Semantic code search |
| ferp | Clone of grep, but written in modern Fortran |
| krep | Optimized string search utility |
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.