[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sharing STDOUT in multiple sha256sum processes
From: |
Pádraig Brady |
Subject: |
Re: sharing STDOUT in multiple sha256sum processes |
Date: |
Fri, 16 May 2014 19:29:31 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 05/16/2014 07:15 PM, Assaf Gordon wrote:
> Hello,
>
> I'd like to ask your advice, to verify that my command is correct.
>
> I'm trying to calculate sha256 checksum on many files, in parallel.
>
> A contrived example would be:
> $ find /path/ -type f -print0 | xargs -0 -P5 -n1 stdbuf -oL sha256sum > 1.txt
>
> Which would run at most 5 processes of "sha256sum",
> and the output of all would be the file 1.txt.
>
> Is it correct to assume that because "sha256sum" prints one line per file,
> and "stdbuf -oL" makes it line-buffered,
> that the content in "1.txt" will be valid (i.e. no inter-mixed lines from
> different processes) ?
That's correct.
Note you don't even need the stdbuf since coreutils 8.1:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=710fe413
thanks,
Pádraig.