Midnight Commander copy/rename with replaced characters

1

0

I would like to copy/rename (F5/F6) with regex (regular expression) mask all the tagged files or directories with names containing space or á or é characters replaced with underscore and a and e characters?

Ex:

an á and another á directory name

an á and é file.txt

=>

an_a_and_another_a_directory_name

an_a_and_e_file.txt

(mc -V 4.8.1 on Ubuntu 12.04)

rid

Posted 2012-09-16T12:02:54.240

Reputation: 11

Do you have to do this with mc or would a bash solution be acceptable? – terdon – 2012-09-16T12:06:25.253

@terdon I wonder if MC has the ability to replace arbitrary characters like perl or sed has with /g (global replace) flag. – rid – 2012-09-16T12:17:07.113

No idea, I don't use it. Would be happy to give a BASH/find solution if you're interested. – terdon – 2012-09-16T12:21:13.830

@terdon - Thanks for trying to help. I could write a small user menu script for mc with sed for ex:

echo "an á and another á directory name" | sed 's/ /_/g; s/á/a/g; s/é/e/g;'

=> an_a_and_another_a_directory_name

...but I would like to find out how to use the regex support bundled in mc for copy/replace functionality. – rid – 2012-09-16T13:00:30.153

No answers