Rename multiple files based on pattern in Unix

前端 未结 22 901
死守一世寂寞
死守一世寂寞 2020-11-22 06:31

There are multiple files in a directory that begin with prefix fgh, for example:

fghfilea
fghfileb
fghfilec

I want to rename a

22条回答
  •  伪装坚强ぢ
    2020-11-22 07:05

    My version of renaming mass files:

    for i in *; do
        echo "mv $i $i"
    done |
    sed -e "s#from_pattern#to_pattern#g” > result1.sh
    sh result1.sh
    

提交回复
热议问题