I'm new to text handling in bash and have hundreds of files with varying names:
TS_01_001_21.0.tif
TS_10_005_-21.0.tif
TS_21_010_-45.0.tif
I want to remove the middle section and the extension so the files look like:
TS_01_21.0
TS_10_-21.0
TS_21_-45.0
So far I have:
for f in *.tif;do
mv "${f}" "${f%.tif}"
done
To remove the extension, but I can't figure out how to remove the middle three characters. Any help would be greatly appreciated, thank you!
TS_01_001_21.0.tifandTS_01_002_21.0.tif?[[ expression ]]. In addition, I would consider using the option-iformv.