Jump to content

CSV File - One more time - Nth row grouping problem


Recommended Posts

Guest phi16181
Posted

I posted an issue earlier and got a great solution (thanks gregm) so I thought Id post the ultimate nth row issue (btw the previously posted problem is a separate issue and unrelated).

 

Here is my problem:

 

I have a csv file with thousands of rows of data in the following format:

 

Code:

data10a

data9a

data8a

data7a

data6a

data5a

data4a

data3a

data2a

data1a

data10b

data9b

data8b

data7b

data6b

data5b

data4b

data3b

data2b

data1b

and so...

 

I need a solution that will eliminate all rows in each group except the first five rows so the desired output is:

 

Code:

data10a

data9a

data8a

data7a

data6a

data10b

data9b

data8b

data7b

data6b

BTW the data for each group is sorted from large to small by value so you could just eliminate all rows in each group except the top 5 largest as long as the ordering stays in place.

 

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