1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-17 18:55:45 +02:00
tldr/pages/common/repren.md

25 lines
932 B
Markdown
Raw Normal View History

2018-04-05 08:48:14 +01:00
# repren
> Multi-pattern string replacement and file renaming tool.
> More information: <https://github.com/jlevy/repren>.
2018-04-05 08:48:14 +01:00
- Do a dry-run renaming a directory of PNGs with a literal string replacement:
2018-04-05 08:48:14 +01:00
2025-07-23 19:08:45 +03:00
`repren {{[-n|--dry-run]}} --rename --literal --from '{{find_string}}' --to '{{replacement_string}}' {{*.png}}`
2018-04-05 08:48:14 +01:00
- Do a dry-run renaming a directory of JPEGs with a `regex`:
2018-04-05 08:48:14 +01:00
`repren --rename {{[-n|--dry-run]}} --from '{{regex}}' --to '{{replacement_string}}' {{*.jpg}} {{*.jpeg}}`
2018-04-05 08:48:14 +01:00
- Do a find-and-replace on the contents of a directory of CSV files:
2018-04-05 08:48:14 +01:00
`repren --from '{{([0-9]+) example_string}}' --to '{{replacement_string \1}}' {{*.csv}}`
- Do both a find-and-replace and a rename operation at the same time, using a pattern file:
2025-07-23 19:08:45 +03:00
`repren {{[-p|--patterns]}} {{path/to/patfile.ext}} --full {{*.txt}}`
2018-04-05 08:48:14 +01:00
- Do a case-insensitive rename:
2025-07-23 19:08:45 +03:00
`repren --rename {{[-i|--insensitive]}} {{[-p|--patterns]}} {{path/to/patfile.ext}} *`