Hacker News new | past | comments | ask | show | jobs | submit login

I do something like:

    < foo.csv (read -r head; echo “$head”; shuf -n 50)
If you do this a lot, you could combine the read/echo into a single shell function.



Or write a Python program. But a quick test shows that CPython (using a pure Python reservoir sampling) is 1/4th the speed of shuf.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: