The ambr command is used for recursive search and replace. It is interactive by default, prompting you for every match found.
Interactive Prompt Options:
y, Y, Yes: Replace the current match.n, N, No: Skip the current match.a, A, All: Replace all remaining matches non-interactively.q, Q, Quit: Stop the process.
Usage patterns:
ambr keyword replacement: Search and replace keyword with replacement in the current directory.ambr keyword replacement path: Search and replace keyword with replacement in the specified path.
Regex and Captures:
If the --regex flag is enabled, you can use regex captures in the replacement string. You can also use the --no-interactive flag to skip prompts entirely.
ambr keyword replacement // recursively search 'keyword' from the current directory, and replace to 'replacement' interactively.
ambr keyword replacement path // recursively search 'keyword' from 'path', and replace to 'replacement' interactively.
# Example with regex captures:
$ ambr --no-interactive --regex '(aaa) (?<pat>bbb)' '$1 $pat ${1} ${pat}' test.txt