RahulJoshi,
Osäker om detta är ett krav som ni ställer.
Kod:
$ split -d -l 6 bigfile subfile
will create subfile00 subfile01 .... with each file of 6 lines
As you want 3 files in output, the l value has to be caluculated like this:
$ awk 'END {printf("%d\n",NR/3+.5)}' bigfile
------------
** The above way of rounding may go wrong in some cases, e.g. suppose the file is having 17 lines,
$ awk 'END {printf("%d\n",NR/5+.5)}' bigfile
3
then,
$ split -d -l 3 bigfile subfile
will create 4 subfiles, which is wrong.
------------
I am sure there can be better solutions to this. Group please.