How can I bulk replace the prefix for many files?
I have a lot of files like
- TestSRConnectionContext.h
- TestSRConnectionContext.m
I would like to change all them to
- CLConnectionContext.h
- CLConnectionContext.m
How would I do this?
|
|
|
|||
|
|
|
You can try with:
See |
|||
|
|
|
I'd say the simplest it to just use the
This of course expects you to be on the directory of the files. This will not overwrite files. If you want that, just pass the EDIT: see jw013 comment below about multiple versions of |
|||||
|
|
Shell parameter expansion is enough for simple transformations like this. Command substitution is less efficient because of the need to spawn extra processes (for the command substitution itself and the
|
|||
|
|
|
Here's one way:
|
||||
|
|
|
If you need something more perlish you can do this
|
|||
|
|
|
Well, it wasn't as hard as i though.
|
|||||
|