The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #9 (permalink)  
Old 09-21-2005
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,245

Code:
perl -pi -e '$_ = "" if ($. >= <start> && $. <= <end> );'

Where <start> is the first line you want to delete and <end> is the last line you want to delete.

eg:

Code:
perl -pi -e '$_ = "" if ($. >= 2 && $. <= 4 );' file

deletes lines 2 to 4.