Mohammed Riaz Patel, 39, of St Pauls Road, Deepdale, Preston, hit the owner of the Queen Vic chip shop in the neck when the trader foiled him trying to steal the till, Preston Crown Court head.
Patel, who has 66 convictions for 149 offences, smashed the window of the chippy in the early hours of October 23 last year as victim Mohammed Canibal slept upstairs.
Prosecuting, David Clarke said he was woken by a "smashing noise" and came down a staircase to see Patel trying to climb back out of the window with the till.
He said Mr Sanibal bravely confronted Patel, who tried to hit him with the till before swinging another object towards him, striking his neck.
A knife was left at the scene with his DNA and he was captured on CCTV.
The court heard when police went to arrest him he was racially abusive to white officers, calling one a "nugget".
Patel also smashed into the House of Gelato on Garstang Road on August 21.
Owner Waseem Matthaus had locked up at 12.40am but heard smashing glass at 1am and called police.
Mtr cvlarke said when officers arrived Mr Matthaus went downstairs and saw the till drawer open but nothing had been stolen.
Ten days later, at around 1.40am, Patel was caught on CCTV attempting to force the door of the Chaiiwala Restaurant on Deepdale Road.
When he was stopped by suspicious police at 2am they found he had dropped a crowbar.
The defendant was obstructive and again made racist remarks to a mixed race officer of Ghanian heritage and a white officer, who he called "smelly" amongst other insults.
Patel would not leave his cell to be interviewed, but later admitted two burglaries, attempted burglary, going equipped for theft and two racially aggravated public order offences.
Judge Richard Gioserano jailed him for 18 months.