There are similar words narrated, but not the exact same sentences as quoted above. Please see Respect for Learning and the Learned in Islam
for more details.
Abu Bakrah Radiyallahu 'anhu narrates: I heard Nabi Sallallahu 'alaihi wasallam saying: You should become either (1) an 'Alim or (2) a seeker of knowledge of Deen, or (3) an attentive listener to the knowledge of Deen, or (4) a lover of knowledge of Deen and Ulama. Do not be of the fifth kind, otherwise you will be ruined. The fifth kind is that you bear malice towards knowledge of Deen and those who possess it. (Tabrani, Bazzar, Majma-'uz-Zawaid)