generalize delimiter & handle no final linefeed