NSW police shoot man after officer stabbed