Solved

no temp file and delte few lines

Posted on 2002-06-26
1
220 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
ID: 7111392
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Expand macro to ask for filename column 8 37
centeredAverage challenge 8 132
modThree challenge 4 80
Problem to open Excel file 15 99
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

21 Experts available now in Live!

Get 1:1 Help Now