Thursday, February 4, 2016

Get a Random Line from CSV file

First line in a CSV file contains column names, so I ignore the line and get a line after it:

$ head -$[$[${RANDOM} % $[`wc -l < ./lines.csv` - 1]] + 2] ./lines.csv | tail -1