2 ms·
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
by fiddlerwoaroof 8y ago
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.
- eesmith 8y agoOr write a Python program. But a quick test shows that CPython (using a pure Python reservoir sampling) is 1/4th the speed of shuf.