you have to separate the chaff from the wheat

You have to separate the chaff from the wheat is another way of saying you must separate what is useful or valuable from something that is worthless. In farming and horticulture, the wheat is something considered very valuable, while the chaff is not, and is similar to weeds or something useless. When used figuratively, it means in any situation you should separate the valuable from the worthless.