Bash script to remove ‘x’ amount of characters the end of multiple filenames in a directory?

 mv $filname $(echo $filename | sed -e 's/.....\.moc1$//');

or

 echo ${filename%%?????.moc1}.moc1

%% is a bash internal operator…

Leave a Comment