parse file line by line