Replace text in a file
edit_fileReplace an exact string in a UTF-8 text file, requiring a unique match by default and optionally replacing all occurrences; writes changes atomically.
Instructions
Replace an exact string in a UTF-8 text file. By default old_string must occur exactly once; use replace_all to replace every occurrence. The file is written atomically.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path or path relative to $HOME. | |
| new_string | Yes | Replacement text. | |
| old_string | Yes | Exact text to find. | |
| replace_all | No | Replace all occurrences. Default false. |