How do I extract lines from a file using their line number on unix?

Posted by monkeyking on Stack Overflow See other posts from Stack Overflow or by monkeyking
Published on 2010-01-06T23:06:03Z Indexed on 2010/03/18 23:21 UTC
Read the original article Hit count: 143

Filed under:
|
|
|
|

Using sed or similar how would you extract lines from a file? If I wanted lines 1,5,1010,20503 from a file, how would I get these 4 lines?

What if I have a fairly large number of lines I need to extract? If I had a file with 100 lines, each representing a line number that I wanted to extract from another file, how would I do that?

© Stack Overflow or respective owner

Related posts about sed

Related posts about awk