remove characters in linux kde CentOS 7 in a bunch of filenames

thebeesknees22

SS.org Regular
Joined
Dec 14, 2019
Messages
2,393
Reaction score
2,163
Location
Le baguette land, Canada
Yo yo!

there are smart people here and google is failing me.
say I have a file blahblah_poop.1001.exr 1002, 1003 etc.. and I want to remove _poop in all files

I tried
rename 's/_poop//g' *.exr but something's not right. I tried sed too

Any linux dudes that can lend a brother a hand? I'm on Cent OS7 and kde. blahblah

and I don't have install or download privileges so i can't install any handy tool to do it.
 

TedEH

Cromulent
Joined
Jun 8, 2007
Messages
11,055
Reaction score
9,277
Location
Gatineau, Quebec
I'm not a linux expert and dealing with regex is always awful, but maybe you need to specify some capture groups, then re-assemble those into your new name.

Something like
rename 's/(.*)(_poop)(.*)/g' '$1$2' *.exr

Maybe? ¯\_(ツ)_/¯ I probably have end part wrong with the dollar signs, you'd have to look that bit up.
 

thebeesknees22

SS.org Regular
Joined
Dec 14, 2019
Messages
2,393
Reaction score
2,163
Location
Le baguette land, Canada
actually got it!
turns out our version of rename came from the utils_linux junk and the 's/' stuff doesn't work with that 💆‍♀️ 🤦‍♀️ 💆‍♀️ 🤦‍♀️


thanks @TedEH ! I think that would have worked if we had the regular version of rename
 
Top