mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Programming (https://www.mersenneforum.org/forumdisplay.php?f=29)
-   -   Script for split file (https://www.mersenneforum.org/showthread.php?t=27787)

petrw1 2022-05-11 05:46

[QUOTE=pepi37;605586]I need script that will "ask" me number of workers and then split input file equally into worktodo.txt file ( and if possible add "Worker line") ( in this case 3 workers)





Thanks[/QUOTE]

Like [URL="https://www.mersenne.ca/balance.php"]this[/URL] does?
Maybe you can access the source.

pepi37 2022-05-11 07:53

[QUOTE=Batalov;605630]bash
[CODE]N=3
for i in `seq 1 $N`; do
echo '[Worker #'$i']'; awk 'a++%'$N'=='$i'-1' input.txt
done > output.txt [/CODE][/QUOTE]




Perfect!
I made two scripts, one for 8 worker one for 12 worker
Thanks!


All times are UTC. The time now is 07:25.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.