sjmulder / divvy

Divide input between multiple instances of a utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

divvy

divvy -n jobs [-L lines] [-d delim] program ...

Divide input between multiple instances of a utility.

Description

Reads batches of lines (1 by default) lines or items delimited by delim from standard input and sends them to up to jobs instances of the given program in a round-robin fashion.

Exits 0 on success, 123 if a program exits with a nonzero status code, or 1 if another error occurs.

Example

Divide a SQL file between 4 Postgres clients, in batches of 50 statements:

$ divvy -n4 -L50 -d\; psql <inserts.sql

The first client will receive the first 50 statements, the second the next 50, and so on.

Running

Should work with any Unix, including Linux and macOS. To compile, install and uninstall from source:

make
make install   [DESTDIR=] [PREFIX=/usr/local] [MANPREFIX=PREFIX/man]
make uninstall [DESTDIR=] [PREFIX=/usr/local] [MANPREFIX=PREFIX/man]

Author

Sijmen J. Mulder (ik@sjmulder.nl). See LICENSE.md.

About

Divide input between multiple instances of a utility

License:BSD 2-Clause "Simplified" License


Languages

Language:C 73.4%Language:Roff 17.5%Language:Makefile 9.2%