for i in {15..30}
do
cat "SG-10_2017-05-${i}de.csv" >> merged
done
the problem is that in the loop i have files that are not present.. Then, I will like to use the date 2017-05-15 as the first file to concatenate to the last file present.
What does it mean for you "bigger tha[n] 2017-05-15". Is 2017-08-10 a possibility?
In that particular example, what would be the ceiling or last file name? Any files you are not showing?
Considering that the day your file gets created has the same date in it's name, if this condition is TRUE then could you please try following and let me know if this helps you.
So explanation in short of above code(as it is too late in IST now, will add full explanation in morning) is getting the days difference and searching only those files which are older than(or same day 2017-05-15) and concatenating their values then into merged file name.
I hope this helps you, let me know if you have any queries on same.
NOTE: If your files are always .csv then you could add a condition like -name *.csv into above command and could test with it too.