I would like to select at random N lines from a big file called input_file
(6250000 lines,N=1250000), output the N lines in a new file called output_file
, and delete the N lines from the original file input_file
.
According to this post, the first two tasks can be achieved with :
sort -R input_file | head -n $N > output_file
How to delete the selected N lines from input_file
?