Jump to content

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


Recommended Posts

Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...