In response to blip #122364
cut -d \ -f1Oberschutze said:
#!/bin/bash for filename in $(ls | grep -E "(^|_)[[:digit:]]{13}\.[[:alpha:]]{3,4}$") do filehash=$(md5sum "$filename" | sed -E "s/ \*.*$//")
is more succinct than this sed incantation.
newfilename=$(echo $filename | sed -E "s/[[:digit:]]{13}/$filehash/")
What's the meaning of the leading _ which you are (possibly) preserving here?
if mv -n $filename $newfilename then echo "$filename -> $newfilename" fi done
Could alternatively write this as:
mv -nv $filename $newfilename done | sed 's/^renamed //'
if it's what I think (you just want a shorter version of the report that mv gives).