This question already has answers here:
How can I extract a predetermined range of lines from a text file on Unix?

(25 个回答)


6年前关闭。




我有一个大文件,但我需要其中的一部分,即 m (1000) 行和 n (2000) 行之间的行。

我怎么才能得到它? (并将其放入一个新的较小文件中,或在屏幕上打印)

最佳答案

42 到 96 行之间:

sed -n '42,96p'  oldfile > newfile

关于bash - 获取第 m 行和第 n 行之间的内容,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27785105/

10-09 00:54