[ACCEPTED]-Copy/Paste part of a file into another file using Terminal (or Shell)-copy-paste

Accepted answer
Score: 23

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

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

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

Score: 3

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

sed -n '1000, 1000000p' path/first/file > path/second/file

More Related questions