Copy/Paste part of a file into another file using Terminal (or Shell)

孤人 提交于 2019-12-03 12:48:36

if you know how many lines are in your source file (wc -l) you can do this .. assume 12000 lines and you want lines 2000 - 7000 in your new file (total of 5000 lines).

cat myfile | tail -10000 | head -5000 > newfile

Read the last 10k lines, then read the 1st 5k lines from that.

Oscar Perëz

sed command should work fine, replace double quotes with single quotes.

sed -n '1000, 1000000p' path/first/file > path/second/file
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!