top of page
Writer's pictureJatin Madaan

How to split a file in unix .


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.

18 views0 comments

Comments


bottom of page