[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: Safely using xargs -P$NUM children's output? Need a new tool?
From: |
L A Walsh |
Subject: |
Re: RFC: Safely using xargs -P$NUM children's output? Need a new tool? |
Date: |
Fri, 03 May 2019 22:34:30 -0700 |
User-agent: |
Thunderbird |
On 5/2/2019 11:49 PM, Denys Vlasenko wrote:
Gnu has a utility called parallel that _says_ it will ensure the
output is consistent with what you would get running
the command sequentially. Perhaps it would work for you? I haven't
used it extensively, so don't know or not, but thought I'd mention it.
---------------
PARALLEL(1) parallel PARALLEL(1)
NAME
parallel - build and execute shell command lines from standard input in
parallel
SYNOPSIS
parallel [options] [command [arguments]] < list_of_arguments
parallel [options] [command [arguments]] ( ::: arguments | ::::
argfile(s) ) ...
parallel --semaphore [options] command
#!/usr/bin/parallel --shebang [options] [command [arguments]]
DESCRIPTION
GNU parallel is a shell tool for executing jobs in parallel using one
or more computers. A job can be a single command or a small script that
has to be run for each of the lines in the input. The typical input is
a list of files, a list of hosts, a list of users, a list of URLs, or a
list of tables. A job can also be a command that reads from a pipe. GNU
parallel can then split the input into blocks and pipe a block into
each command in parallel.
If you use xargs and tee today you will find GNU parallel very easy to
use as GNU parallel is written to have the same options as xargs. If
you write loops in shell, you will find GNU parallel may be able to
replace most of the loops and make them run faster by running several
jobs in parallel.
GNU parallel makes sure output from the commands is the same output as
you would get had you run the commands sequentially. This makes it
possible to use output from GNU parallel as input for other programs.
Re: line buffering in pipes, Assaf Gordon, 2019/05/02