A man has been sentenced to two and a half years in prison after slashing a man across the stomach with a knife.