Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim | remove first few lines from a 700MB file

How do I quickly scrape off first few lines from a large file, without opening the whole file in main memory?


UPDATE

I do not want to pipe the starting x lines into another file and then cut the first few lines, I want to update the original file.

like image 896
Vaibhav Bajpai Avatar asked Dec 27 '10 20:12

Vaibhav Bajpai


People also ask

How would you remove two lines of text from a file using the vi text editor?

To delete a line in Vi or Vim, switch to normal mode first. If you're into command mode or insert mode, you can switch back to normal mode by pressing Escape. Highlight the line that you want to delete, then hit dd or D on the keyboard. The editor will automatically remove the whole line from the file.


1 Answers

Not exactly vim, but to cut of the first 10 lines you could use

tail --lines=+10 somefile.txt > newfile.txt
like image 185
Darcara Avatar answered Sep 21 '22 18:09

Darcara