Free-Roaming Hostility From A QA/Developer Perspective.
April 18, 2013
HOWTO: Get a random sampling of lines from a text file in bash
Let's say you needed to get 150 lines at random from a text file and you were running Linux.
The solution involves a command I wasn't aware of until today...
shuf file-to-sample.txt | head -n 150
shuf scrambles all the lines in the file; head pulls the set number of lines for you.
4/18/2013 03:17:00 PM
Share to Twitter
Share to Facebook
Share to Pinterest
Post a Comment
Post Comments (Atom)