String Replace
str_replaceReplace an exact, unique string in a file using absolute paths; omit the replacement to delete it. Fails if the target appears zero or multiple times.
Instructions
Replace an exact string in a file.
old_str must match exactly and be unique in the file
If old_str appears 0 times or more than once, the operation fails
If new_str is omitted, old_str is deleted
Use absolute paths
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to file | |
| new_str | No | Replacement string (omit to delete) | |
| old_str | Yes | Exact string to find (must be unique) |