Difficulty with rename
I am having trouble with using rename.
Trying to remove spaces and dashes from file names. I thought all I had to do was add /char to be deleted/ rename "s/ //-//g" * |
Quote:
But the part you are looking for is the substitution operator. The details are found in the manual page perlop The dividers are usually slashes ( / ) but can be pretty much any character that is repeated three times. Code:
s/old/new/ So you are looking for any character in a set consisting of a space or a dash. That's written like [ -] with the square braces delimiting the set. And, I presume, you want to zap every last occurrence in the file name. So you'll need the g modifier, to tell it to keep matching through the end of the string (file name). Code:
rename -n 's/[ -]//g' ./* If you want to see more of what "rename" can do, look up some material on perl regular expressions. They are quite useful. |
All times are GMT -5. The time now is 06:36 PM. |