The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #13 (permalink)  
Old 06-26-2009
rakeshawasthi rakeshawasthi is offline
Registered User
  
 

Join Date: Aug 2004
Location: India
Posts: 379
Quote:
Originally Posted by dinesh1985 View Post
Thanks for your replies ..i ll try it and update

---------- Post updated 06-26-09 at 03:20 AM ---------- Previous update was 06-25-09 at 03:54 AM ----------

I donot want to redirect to any new file. I want to delete the line from the file itself.
I have tried sed -i '3d' to delete the 3rd line. But my shell is not recognizing sed -i.

I have tried sed '3d' <filename> ..it is displaying the file without the 3rd line. But the 3rd line is not permanently deleted. Can anyone please help
With a little trick you can redirect the output of sed into the same file

Code:
sed '3d' file | tee file