Changing file names

I have file names as shown and want to change the name to have only the first four numbers.

/home/chrisd/Desktop/nips/nips_2013/5212-learning-feature-selection-dependencies-in-multi-task-learning.pdf
/home/chrisd/Desktop/nips/nips_2013/5213-parametric-task-learning.pdf
/home/chrisd/Desktop/nips/nips_2013/5214-direct-0-1-loss-minimization-and-margin-maximization-with-boosting.pdf
/home/chrisd/Desktop/nips/nips_2013/5215-reservoir-boosting-between-online-and-offline-ensemble-learning.pdf
/home/chrisd/Desktop/nips/nips_2013/5216-beyond-pairwise-provably-fast-algorithms-for-approximate-k-way-similarity-search.pdf

This link here should help.

There are many examples of this. Try:

dir=/home/chrisd/Desktop/nips/nips_2013
cd "$dir"
for f in *.pdf
do
  if [ -f "$f" ]; then
    mv -- "$f" "${f%%-*}"
  fi
done

Are you sure that the first four number are unique? You could lose data if not:-

mv 1234-fileA 1234
mv 1234-fileB 1234

..... and fileA is lost.

Robin