Solved

no temp file and delte few lines

Posted on 2002-06-26
1
225 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 102
dog bark java program 15 121
has77  challenge 9 99
Problem to event 3 114
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.

730 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