I´m trying to rename a list of files by removing the "tmp." string
for example 1.tmp.tax.html
will become 1.tax.html
(base) [david@archlinux ~]$ ls -ltr test/
total 684
-rw------- 1 david users 229779 Nov 7 11:43 1.tmp.tax.html
-rw------- 1 david users 229779 Nov 7 11:43 2.tmp.tax.html
-rw------- 1 david users 229779 Nov 7 11:43 3.tmp.tax.html
rename 's/tax.//' test/*.html
No output message, nothing renamed. What´s wrong???
(base) [david@archlinux ~]$ rename --version
rename from util-linux 2.34
(base) [david@archlinux ~]$ uname -a
Linux archlinux 5.3.7-arch1-2-ARCH #1 SMP PREEMPT @1572002934 x86_64 GNU/Linux
rename
from util-linux doesn't use substitution with regular expressions.
$ rename -h
Usage:
rename [options] <expression> <replacement> <file>...
So, in your case,
rename .tmp. . test/*.html
BTW, when using the other rename, note that .
is special in regular expressions (it matches any character but newline). So, your command would remove eg taxi
from file names, too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.