This question already has an answer here:

I have a 300000 lines in a text file. And I have a file with list of line numbers that I need to extract from text file. Numbers are ordered. They are not ranges and there are about 4000 of them. So I need 4000 lines from source text file with specified ids.

Are there any efficient way to copy lines specified in a such file to a new file with unix console tools? Or any lightweight script?

marked as duplicate by don_crissti, terdon Nov 10 '15 at 13:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.