top of page

How to split a file in unix .

  • Writer: Jatin Madaan
    Jatin Madaan
  • Apr 29, 2019
  • 1 min read

There is a split command in unix which can divide a large file into multiple files based on number of lines .


Command :


$ split -l [no. of lines in which we want to divide source file] [file name]


eg :




Output is files with name xaa , xab ,xac and xad where xaa file contains first 6 lines of date.txt file and similarly xad file contains last 6 lines of source file date.txt .


In case we need to give names to file then use below command :



Though aa , ab ,ac and ad postfix would be added for readability but could be helpful in case required.

Comments


  • linkedin

©2019 by Jatinmadaan

bottom of page