uses LineIterator
removes trailing white spaces