renaming files, please help

I want to rename the files by taking part of the file and appending date to it. please help
e.g.
abc-390.csv
xyz-908.csv
desired format is abc_YYYYMMDD.csv

This is what I have but it is not working

for each in *.csv;
do
mv $each /abc/data/"`date '+test_%Y%M%M'`".csv
done

Take a look at

Also, do a search on this forum for rename file date

Ignoring the %M appearing twice, we assume you meant %Y%M%D .Your main problem is the parameters to "date". They are case significant. date +%D displays a date mm/dd/yy complete with solidus characters which is not good in a filename! date +%d displays just the day number (01-31). Also date +%M is minutes not the month number!

date +%Y%M%D 
20082011/14/08

date +%Y%m%d
20081114

To avoid generating a shell command which is too long, when working with long lists of filenames they should be presented as a list not as multiple arguments on the same line. There are many ways of doing this. Here is one. Test with echo statements before moving files around. It is all too easy to generate duplicate filenames.

#!/bin/ksh
YYYYMMDD="`date +%Y%m%d`"
ls -1 *\.csv|while read OLD_NAME
do
    echo "Old filename: ${OLD_NAME}"
    PREFIX="`echo ${OLD_NAME}|cut -f1 -d-`"
    NEW_NAME="/abc/data/${PREFIX}_${YYYYMMDD}.csv"
    echo "New filename: ${NEW_NAME}"
    # if [ ! -f "${NEW_NAME}" ]
    # then
    #      mv "${OLD_NAME}" "${NEW_NAME}"
    # else
    #      echo "New filename already exists: ${NEW_NAME}"
    # fi
done