Find and replace text across many files at once, in ONE command, with a preview first: a company name, a year, a price, a product name or a pattern (regular expression) in Word (.docx), PowerPoint (.pptx), Excel (.xlsx), text, Markdown, CSV and HTML files, keeping the documents' formatting. Use for: change the old company name in all these documents, replace 2026 with 2027 in every file, update the price in all offers, how many files mention X, bulk rename a term across a folder. Triggers: find and replace, search and replace, replace in all files, bulk replace, rename across documents, how many times does X occur in these files.
Say it in your own words; the assistant finds this recipe by itself. Examples:
Find and replace text across many files at once, in ONE command, with a preview first: a company name, a year, a price, a product name or a pattern (regular expression) in Word (.docx), PowerPoint (.pptx), Excel (.xlsx), text, Markdown, CSV and HTML files, keeping the documents' formatting. Use for: change the old company name in all these documents, replace 2026 with 2027 in every file, update the price in all offers, how many files mention X, bulk rename a term across a folder. Triggers: find and replace, search and replace, replace in all files, bulk replace, rename across documents, how many times does X occur in these files.
python3 /skills/find-replace-files/scripts/replace.py <verb> … — inputs in /work/in, changed copies
in /work/out (originals untouched). Always run count first and tell the person what will change,
then apply. Each verb prints one OK … line or ERROR ….
| Need | Command |
|---|---|
| Preview: how many matches per file | replace.py count --find "Acme A/S" /work/in/*.docx /work/in/*.pptx |
| Replace everywhere | replace.py apply --find "Acme A/S" --with "Nordic Widgets ApS" --out /work/out /work/in/* |
| Ignore upper/lower case | add --ignore-case |
| Pattern (regular expression) | replace.py apply --regex --find "20(2[0-6])" --with "2027" --out /work/out /work/in/*.md |
| A whole folder | give the folder instead of files: replace.py count --find X /work/in |
Report the per-file counts from count, then the totals from apply, with the download links.
SKILL.mdscripts/__pycache__/replace.cpython-311.pycscripts/replace.pyWritten by Percerno, MIT licence.