The men sentenced on Saturday were among 81 civilians, including members of the opposition Islamist Popular Congress (PCP) party, on trial accused of helping organise the September coup attempt. Nine were tried in absentia.
All the other men were acquitted and freed.
"The men were not given the death sentence or life sentences because they are politicians," the judge said after the sentences were announced.
Kamal Omar, the men's lead lawyer, previously said 15 to 20 of the men indicted were members of the PCP. It was not immediately known whether any of those found guilty were members.
Twenty-one men from the Sudanese armed forces are being tried in a military court for involvement in the coup attempt.
Hassan al-Turabi, leader of the PCP, was jailed by Sudanese authorities after another coup attempt in March 2004. Al-Turabi, the former ideologue of Sudanese President Omar al-Bashir, was moved to house arrest last month.
Government officials say al-Turabi likely will be released after emergency law is lifted in Khartoum, which is expected after agreement on a new constitution.
Allegation of torture
Omar said earlier court proceedings against the 81 were flawed and confessions were extracted under torture and threat of death.
The government has said the men were treated well during investigations.
Sudan's attorney-general has said most previous convictions for political crimes resulted in prison sentences and most inmates have been released before they served the full sentence.
Omar said many of the men were from Sudan's Western Darfur region, where two main rebel groups took up arms against the government in early 2003 complaining of discrimination and neglect.