I've gotten this so far :
Code: Select all
for i in *;do mv \'$i\' \'`echo $i|sed -e "s/'/\'/g" -e 's/ \[[A-Za-z0-9\+\!]*\]//g' -e 's/ ([J U E])//g'`\';doneCan anyone help me sort out this sed nightmare?
Code: Select all
for i in *;do mv \'$i\' \'`echo $i|sed -e "s/'/\'/g" -e 's/ \[[A-Za-z0-9\+\!]*\]//g' -e 's/ ([J U E])//g'`\';doneCode: Select all
... ; do mv "$i" "`...`" ; ...Code: Select all
for i in * ; do mv "$i" "`echo $i | sed -e 's:\ .*\.:\.:'`" ; doneCode: Select all
for i in * ; do (echo $i | grep "\[[A-Za-z0-9\+\!]*\]\ ([JUE]*)") && mv "$i" "`echo $i | sed -e 's:\ .*\.:\.:'`" ; doneCode: Select all
find . -maxdepth 1 -type f | perl -ple '$a=$_;s/([a-z]+)\s\[[^\]]+\]\([^\)]+\)/\1/;rename $a, $_'
Yes, I have to agreeTGL wrote:I tend to think that the right tool is the one you know, but it's somehow offtopicfyerk wrote:It seems like this would be much easier as a combination of find and a Perl one-liner.

For command line, you also have "ren" (emerge sys-apps/ren) which is very good for this kind of task. Here, it would have something like this:funkmankey wrote:I chose the lazier route and installed krename.
Code: Select all
# ren "* [*] (*).*" "#1.#4"