only keep start/end of successive lines