'How can I split content of a file to two different files using shell script

I want to split a file into two parts

I want to split a single file into two different files using shell script.



Solution 1:[1]

You can use linux split command, either by lines split -l<num_of_line> <file_name> or by size split -b<size><K|M|G> <file_name>.

For example: split -l100 a.txt will split each 100 lines into separate files.

Here is a link you can see more examples and all details.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Antoine Baqain