while (sleep 1) { read all data into an array... extract last element... process it.. write to a secondary file the extracted data for comparison purposes.. }