Suppose we want to split a text file into several parts with 5 lines each.
Here is a contents of our test text file:
$ cat ./text 123 456 789 asc def ghi 321 654 987 qwe asd zxc
We will use split command for this.
$ split -l 5 ./text part_
where -l 5 describes lines number in each part, ‘part_’ is a prefix of the name for newly created files. What we got?
$ ls part_aa part_ab part_ac text
Currently we have 4 files – one original and three new called part_aa, part_ab and part_ac. These files contain individual parts of text file.
$ cat ./part_aa ./part_ab ./part_ac 123 456 789 asc def ghi 321 654 987 qwe asd zxc