More fixups on repren and rename.

Re #296.
This commit is contained in:
Joshua Levy 2015-11-02 10:20:25 -08:00
parent b8c0185102
commit 122a25db8c

View file

@ -207,11 +207,13 @@ Notes:
perl -pi.bak -e 's/old-string/new-string/g' my-files-*.txt perl -pi.bak -e 's/old-string/new-string/g' my-files-*.txt
``` ```
- To rename many files and/or search and search and replace within files, try [`repren`](https://github.com/jlevy/repren). The `rename` command also does renames on some Linux distributions (but it is less consistently available). - To rename multiple files and/or search and replace within files, try [`repren`](https://github.com/jlevy/repren). (In some cases the `rename` command also allows multiple renames, but be careful as its functionality is not the same on all Linux distributions.)
```sh ```sh
# Full rename of filenames, directories, and contents foo -> bar: # Full rename of filenames, directories, and contents foo -> bar:
repren --full --preserve-case --from foo --to bar . repren --full --preserve-case --from foo --to bar .
# Recover backup files foo.bak -> foo: # Recover backup files whatever.bak -> whatever:
repren --renames --from '(.*)\.bak' --to '\1' *.bak
# Same as above, using rename, if available:
rename 's/\.bak$//' *.bak rename 's/\.bak$//' *.bak
``` ```