I have a file that contains 3494 lines, of which I would like to randomly select 100, and write those lines to a new file. I can do that using this:
shuf -n 100 input_file.txt output_file.txt
However, I have many such input files, and I'd like to select the same 100 lines from each file. That is, I need to keep the line indices chosen by the first
shuf and select those same lines in the other files. How can I do this?
The first answer was helpful, but I still have an issue with selecting from the correct file. I have 10 files from which I would like to select the same 100 lines. I end up with 1100 lines somehow.