Solved

no temp file and delte few lines

Posted on 2002-06-26
1
219 Views
Last Modified: 2013-12-26
Hi,

How can i delete first few lines from a file, without creating a temporary file.

My problem is: I have a very big file and i have to delete the first 4 lines of the file. As the file is too big i want to avoid creating a temp file.

I can do it by creating a temp file like thi

sed '1,4d' file1 > file2
mv file2 file1

But i don't want to create a temp file.

Thanks
GG
0
Comment
Question by:ilikenine
1 Comment
 

Accepted Solution

by:
woregul earned 50 total points
Comment Utility
You can use the ex editor as follows:

ex -s file1 <<END
1,4d
wq!
END

or if you want the ex commands in a separate file:

commands:
1,4d
wq!

ex -s file1 < commands
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now