Awk scripts to read rows in a column with the same/differen value

  • Thread starter Thread starter psu4
  • Start date Start date
P

psu4

Hello gurus,

If we have a csv input here

Code:
Apple_ID, FDA_ID,Date
567,3, “10/12/2008 12:00:00 AM”
567,1, “10/12/2007 12:00:00 AM”
348,1, “10/12/2008 12:00:00 AM”
567,2, “10/12/2009 12:00:00 AM”
And we like to read the first column, if the Apple_ID is the same (567 for example) AND FDA_ID (1,2,3 for example) is different, print the row with the most recent Date (567,2, “10/12/2009 12:00:00 AM” in this case).

In this case, the desire output would be:

Code:
Apple_ID, FDA_ID,Date
348,1, “10/12/2008 12:00:00 AM”
567,2, “10/12/2009 12:00:00 AM”
We try to write some arrays using the examples in other posts but doesn’t seem to work.

http://unix.stackexchange.com/questi...r-column-value

Any hint could be quite helpful. Thanks!

Continue reading...
 
Back
Top