Rename_in_bash_with_perl_or_sed_with_for_loop
for i in *pdf;do
new=$(echo $i | perl -pe 's/(.*?)_(.*?)(_\d*.pdf|.pdf)/\2__\1__\3/g')
mv "$i" "$new"
done
for i in *pdf;do
new=$(echo $i | perl -pe 's/(.*?)_(.*?)(_\d*.pdf|.pdf)/\2__\1__\3/g')
mv "$i" "$new"
done