I would like to know is it possible to copy line number 7,8,9 and 17,18 of one text file to another one?
Thanks much in advance!!!
You can use
you should not rely on the order of the lines on a file, because it might change (if it is a system file, a temp file ecc. and it's updated).
Then, after you see that the lines printer are right, you can use:
It will append the lines printed by rgrep to the second file; to overwrite use ">" and not ">>".
(these are 2 separate intervals)
(>> to append>
Copy & paste the line: it will do the job. :-)
If you know how many lines are there 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).
Read the last 10k lines, then read the 1st 5k lines from that.