removing the dash within the name of multiple files
Hi there --
One of the directories on one of our servers, running Red Hat Enteprise 5, contains a series of files, similar in name, that contain a dash within the file name. Several examples are shown below: Quote:
Quote:
|
Code:
rename '-' '' * ; rename '--' '' * |
Thanks...It worked.
|
Caution. There are at least two different programs called rename, with different syntaxes. Many debian-based systems use a perl-based version with "s///" style replacement patterns. Check the man page first.
You could also simply use a loop with an appropriate parameter expansion. Code:
for file in CTS* ; do mv "$file" "${file/--}" ; done |
Hi there --
I had a chance to try the for loop in another situation, and it worked as well. Thanks. |
All times are GMT -5. The time now is 03:54 PM. |