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 > 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 -->
  #2 (permalink)  
Old 09-21-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
I could think of this:
Code:
sed -n "${to},${from}p" file_to_cut_lines_from | cat > file_to_cut_lines_from
You can use this to get a block of lines from a file, deleting the rest of the lines (because of the >).

This works in ksh, but is not portable in sh and bash. This has to do with the way ksh treats the '>'. There is a post where Perderabo has given an explaination for this - but I cant seem to remember where that post is...

Last edited by blowtorch; 09-21-2005 at 01:58 PM..