Hello, I have a log file with the following input: X , ID , Date, Time, Y 01,01368,2010-12-02,09:07:00,Pass 01,01368,2010-12-02,10:54:00,Pass 01,01368,2010-12-02,13:07:04,Pass 01,01368,2010-12-02,18:54:01,Pass 01,01368,2010-12-03,09:02:00,Pass 01,01368,2010-12-03,13:53:00,Pass 01,01368,2010-12-03,16:07:00,Pass My goal is to get the number of times ID has a TIME that's after 09:00:00 each DATE. That would give me two output. one is the number of days ID has been late, and secondly, the day and time this ID has been late . I've started as such: sort -t ',' -k 3,3 -k 4,4 file.log # this will sort the file according to the DATE field as well as the Time fileld. I'm stuck for the last 30 min to find a way to get the first line of each day (logically it'll be the earliest as i've sorted by date/time previously) once i know how to do this, i'll be able to compare time and proceed.. Can any one help ? i looked into sort - u and uniq -f3 though i didnt get far with it..