Hi,
I have a file that consist of around six million line, now the task is to divide this file into 12 small file so that each file would have half a million lines in it.
Thanks.
Hi,
I have a file that consist of around six million line, now the task is to divide this file into 12 small file so that each file would have half a million lines in it.
Thanks.
Read the man page for split
.
You can use sed and do it in a very nice way.
$ sed 1,500000p
or something like that.
Don't use split for straight forward line splitting.
-Girish
Absolutely terrible advice.
split is the perfect tool for the job. This task requires a little arithmetic and creating multiple files with unique names. split handles both. sed handles neither.
Ironically, your "straight forward" sed suggestion is seriously broken: sed 1,500000p
will print the first 500000 lines twice and the next 11.5 million once.
Regards and welcome to the forum,
Alister