How to randomly sample k lines from a file in *nix
You can use the shell to extract a random sample of lines from a file in *nix. The two commands you need are “shuf” and “head” (+ “tail” for CSV files with a header). The shuf command will randomly shuffle all the lines of its input. The head command will cut of the input after …
How to randomly sample k lines from a file in *nix Read More »