How to Split File into Sections

Question - I have a file and I want to split it into separate files, is there a way to do so?

Answer - you can use the sed command for this action:

sed -n 'X, Yp' file.txt > new_file.txt

Result - you will have a new file with rows from 1000 - 2000

Example

sed -n '1000, 2000p' <file.txt> > <new_file.txt>

   

  • 33
  • 14-Jul-2015
  • 581 Views