CCTV operators spotted Michael Moore dropping the knife, then retrieving it, on Gateford Road, on April 3.
When officers approached him, outside the Everest Tandoori where he was collecting his dinner, he lifted up his T-shirt and showed them a kitchen knife, tucked into his waistband.
In police interview, he said he was beaten up by four men at his home address the day before.
Sarah Neale, mitigating, said: "Someone suspected he had stolen money. He hadn't - but that was why he was attacked. He maintained that he hadn't stolen it.
"About a week afterwards, someone apologised for the attack. He notified the police but said he doesn't want to proceed with the complaint.
"He panicked. When going to collect his dinner he took a knife. It was more a scare tactic. He appreciates the severe error of judgment."
She said he not been in court since 2003, but was now involved with the crisis team because he is suffering from depression.
"He now has access to a drug and alcohol worker because of past problems," Ms Neale said.
Moore, 55, of Park Street, admitted the offence when he appeared at Mansfield Magistrates Court, on Friday.
He received a three month prison sentence, suspended for 12 months, with 15 days of rehabilitation.
He must also pay £85 costs and a £115 government surcharge.