bash string split

I have a bunch of files named 123_345.ab
all should be renamed to 123.ab

for i in $(ls .); do
   mv $i ${i%_*}.ab
done

If you need the 2nd part of the filename ${i#*_} instead

Leave a Reply