Solved

no temp file and delte few lines

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Folder Comparison 12 54
Named range not carried over 10 63
noX challenge 17 112
how to use laptop or pad camera in vb.net windows application 2 70
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

816 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

10 Experts available now in Live!

Get 1:1 Help Now