The quick and dirty answer would be as follows:
array=(`echo {a..z}{a..z}{a..z}`);i=0; for FILENAME in *; do mv $FILENAME REF${array[i]}_$FILENAME; i=$(($i+1)); done
But I'd prefer doing it as a script which you can then run - its easier to maintain and describe
array=(`echo {a..z}{a..z}{a..z}`)
i=0
for FILENAME in *
do
mv $FILENAME REF${array[i]}_$FILENAME
i=$(($i+1))
done
The first line loads up a sequence of 3 digit letters, starting aaa, and proceeding down to zzz. You can decrease or increase the size of this array by increasing or decreasing the number of {a..z} - and you could replace it with capital letters or some other simple sequence.
i is a counter which we increment so we can get a unique sequence for each REF value.
I note that I don't like the "FILENAME in *" bit of code, because it won't play well with subdirectories. I'd be inclined to replace that line with
for FILENAME in `find . -type f`
to handle files, including subdirectories, or
for FILENAME in `find . -maxdepth 1 -type f`
for files only in the current directory (ie not recursing it, and ignoring directories)
1Can you use numbers instead of letters ? That would make the problem much easier to solve. Also, are you using it for ordering purposes (in which case we would want to pad it) – davidgo – 2017-07-04T09:43:35.690