dimanche 5 juillet 2015

To Split into fixed sequences and leave extra out

I would like to limit all files to be of the same fixed length but the last item can be any variable size but not more than 557. This mean that the file amount can be more than determined by the flag -n of the command split.

Code

$ seq -w 1 1671 > /tmp/k && gsplit -n15 /tmp/k && wc -c xaa && wc -c xao
557 xaa
557 xao

where xaa is the first file of the sequence, while xao the last one. I increase the sequence by one unit but it causes 5 unit increase (557->562) in the last file xao which I do not understand:

$ seq -w 1 1672 > /tmp/k && gsplit -n15 /tmp/k && wc -c xaa && wc -c xao
557 xaa
562 xao

Why does the increase of one-unit in sequence increase the last item (xao) by 5 units?

How can you limit the sequence length first, for instance to be fixed at 557 and later determine the amount of files of successful files?

Aucun commentaire:

Enregistrer un commentaire