csvtk icon indicating copy to clipboard operation
csvtk copied to clipboard

Shuffle rows: csvtk shuf /or/ csvtk sort -R

Open tseemann opened this issue 3 years ago • 3 comments

I want to randomly re-order the rows in my CSV file.

Basically unix shuf or sort -R but for xSV data.

The actual use case is to shuffle the data before using csvtk uniq -n 40 say. Is this possible?

tseemann avatar Jun 20 '21 22:06 tseemann

shuf has feature -n to output only N rows, very important for taking a sample out of a big file.

VladimirAlexiev avatar Aug 23 '21 14:08 VladimirAlexiev

Has this been implemented into csvtk? Or is it a matter of piping into shuf? If so, how can we skip the header line from the shuffling? Thanks in advance.

avilella avatar Jul 28 '22 12:07 avilella

Not yet, it should be easy.

shenwei356 avatar Jul 28 '22 14:07 shenwei356