regex help

Linux for blind general discussion blinux-list at redhat.com
Wed Feb 9 16:24:22 UTC 2022


On my end, I'd probably do something like.

rename.ul "." " " *.txt
repeat until all periods are gone.
rename.ul "  " " " *txt
repeat until double spaces are gone.
rename.ul " txt" ".txt" *txt

to restore the dots before the extention...

Admittedly, this is a bit clunky, and assumes the only dots you want
to keep are the ones before the extentions... Also, I'm running an old
version of util-linux because newer versions either drop rename.ul in
favor of making people use Perl's rename package or changed the syntax
in a way I found harder to use...

So while we're on the subject of renaming stuff, can anyone suggest a
more current rename utility where doing a simple search and replace on
all files in the working directory is as simple as:

command "string to replace" "string to replace with" *

perhaps with replace  all instances in a filename instead of just the
first as default or a simple dash single letter option?

I don't doubt the power of perl rename, but the last time I tried it,
something as simple as replace one string literal with another string
literal was more complicated than I was comfortable with and those
account for the majority of cases where I want to batch rename stuff.




More information about the Blinux-list mailing list