Batch remove substring from filename with special characters in BASH

前端 未结 2 475
渐次进展
渐次进展 2021-01-20 15:01

I have a list of files in my directory:

opencv_calib3d.so2410.so
opencv_contrib.so2410.so
opencv_core.so2410.so
opencv_features2d.so2410.so
opencv_flann.so24         


        
2条回答
  •  醉梦人生
    2021-01-20 16:03

    Try this in your mv command:

    mv "$f" "${f/.so/}"
    

    First match of .so is being replaced by empty string.

提交回复
热议问题