Hadithcore
Mishkat al-Masabih, 3954

Abu Usaid reported God’s Messenger as saying at the battle of Badr, “When they come near you shoot at them, but do not draw your swords till they are close upon you.” Abu Dawud transmitted it.

وَعَنْ أَبِي أُسَيْدٍ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَوْمَ بَدْرٍ: «إِذَا أَكْثَبُوكُمْ فَارْمُوهُمْ وَلَا تَسُلُّوا السُّيُوفَ حَتَّى يَغْشَوْكُمْ» . رَوَاهُ أَبُو دَاوُدَ

References1 variant
In-Book Reference
Book 19, Hadith 166