#!/bin/bash
i=1
#set -x

rm -f ../*.xlsx

while read -r commune lat lon; do
 #echo "$i $commune"

 commune2="${commune} ${lat} ${lon}"
 commune2="${commune2%%4*}"
 commune2="${commune2%%5*}"

 file=${commune2%\ }.xlsx

 ls "$file" &>/dev/null 
 if [ $? -ne 0 ] ; then 
  echo "$file not found"
 else
  cp "$file" ..
 fi

 i=$(( $i +1 ))
done < list.txt
