Performs byte-exact, non-overlapping replacement.
-file PATH File to modify. Use - for stdin/stdout.
-old TEXT Exact source text.
-old-file PATH Read source text from a file.
-new TEXT Replacement text; an empty value deletes matches.
-new-file PATH Read replacement text from a file.
-count N Replace at most N matches; 0 means all.
-expect N Require exactly N total matches; 0 disables validation.
-allow-missing Succeed when the source text is absent.
-dry-run Print transformed content without modifying the file.
-json Print operation metadata as JSON after a file edit.
-no-sync Skip syncing temporary file contents before replacement.
-old and -old-file are mutually exclusive. The same applies to -new and -new-file. Missing text is an error by default, which protects coding agents against stale edits.
Inserts content at a file or line boundary.
-file PATH File to modify. Use - for stdin/stdout.
-text TEXT Content to insert.
-text-file PATH Read inserted content from a file.
-at POSITION start, end, before, or after.
-line N 1-based line number required by before and after.
-raw Insert exact bytes without adding a separator.
-eol STYLE auto, lf, or crlf. Default: auto.
-dry-run Print transformed content without modifying the file.
-json Print operation metadata as JSON after a file edit.
-no-sync Skip syncing temporary file contents before replacement.
In line mode, EditPro adds only the separator required to prevent the inserted content from merging with an adjacent line. auto uses the first line ending detected in the source and falls back to LF.
When -file - is used, EditPro reads all source bytes from stdin and writes transformed bytes to stdout. JSON cannot be combined with stdout content mode. Successful file operations print a short summary or JSON when requested. Errors are written to stderr and return exit status 1.
editpro edit -file app.go -old 'OldName' -new 'NewName' -expect 1
editpro edit -file app.go -old-file before.txt -new-file after.txt
editpro insert -file app.go -at after -line 20 -text '// next line'
editpro insert -file data.bin -at end -text-file trailer.bin -raw
editpro edit -file app.go -old foo -new bar -dry-run