Extract the header part content of a stream based on given separator