adb_file_replace
Replace text in Android device files safely. Supports global or line-targeted edits, optional backups, and root access.
Instructions
Find and replace text in a file on the device. Uses sed internally with proper escaping — exposes a safe interface without requiring sed syntax knowledge. Supports global replacement, line-targeted edits, and optional backup creation. Reports match count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path on device | |
| find | Yes | Text to find (literal string, not regex) | |
| replace | Yes | Replacement text | |
| global | No | Replace all occurrences (default: true). Set false for first-only. | |
| lineNumber | No | Restrict replacement to a specific line number | |
| backup | No | Create a .bak backup before modifying | |
| root | No | Use root shell for protected paths | |
| device | No | Device serial |