The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 01-07-2009
shabs1985 shabs1985 is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 13
Question

Quote:
Originally Posted by palanisvr View Post
Try this :

##--NOn interactive deletion of lines using vi- editor
vi - a.txt <<END
:11d
:12d
:x
END

##the above code will delete 11th and 42nd line , saves the file and exits

dump the above code in a script and execute it ...

you can also achive the same using sed but sed is a temporary one it wont make the changes permanent to the source file....
thats fine. how do i do it in sed, i could pipe the changes into a new file. i prefer single line commands as i haven't mastered executing scripts yet.