parse and count lines