To punish someone so as to give a warning to others.
To berate someone at length, usually from a position of authority or moral authority.