The assailant, identified as Murat Sahin, was seen in video footage surrendering calmly to the authorities after the attack, the Hurriyet Daily News reported.
Sahin was reported to have a criminal record for similar armed attacks.
Both journalists face a maximum life sentence for revealing state secrets, but deny their guilt and claim the state violated their rights.
The court later sentenced Dundar to five years and 10 months and Gul to five years for revealing state secrets. They were acquitted on other charges.
Turkey's crackdown on journalists and restrictions on freedom of speech was previously criticized by the international community, including the United Nations, the United States, the European Union, Russia and the Reporters Without Borders (RSF) organization.