Solved

no temp file and delte few lines

Posted on 2002-06-26
1
223 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate into files by filename 12 87
Separate files macro - Errors on larger data set 18 73
ORA-01403: no data found 43 106
MaxSpan challenge 9 105
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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