Rename and *-operator
Is it possible to use * sign at "rename -s" (or rename 's/\arg1/arg2/') arguments?
For example: I have files test1_456, test2_776 and test3_487, and i want to strip the _-sign and everything that comes after that. Logically thinking command Code:
rename -s '_*' '' test* Is there some other way to do this, or have i just failed something? |
I never used 'rename', and on Fedora it doesn't seem to have a '-s' option, but if it uses regexps, what you're saying with '_*' is '_ repeated 0 or more times', which is not what you want. Try using '_.*' instead (notice the '.' between '_' and '*' -- check grep's manpage for basic additional info on regexps).
HTH Andre |
I have somewhat modified version of rename. That -s operator is just supposed to do same stuff as 's/\//'-format, it just uses little easier syntax. It does not, however, use regexps, but thankfully 's/\//' does, and your advice worked perfectly for that.
|
All times are GMT -5. The time now is 06:24 PM. |