Nguyễn Trường Sinh
Member
How do I extract a specific line from a file in Unix?
Answer
To extract a range of lines, say lines 2 to 4, you can execute either of the following:
Answer
To extract a range of lines, say lines 2 to 4, you can execute either of the following:
- $ sed -n 2,4p somefile. txt.
- $ sed ‘2,4! d’ somefile. txt.