parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -0/--null behavior with --pipe


From: Ole Tange
Subject: Re: -0/--null behavior with --pipe
Date: Tue, 24 Apr 2018 22:16:43 +0200

On Tue, Apr 24, 2018 at 3:45 PM, Jean-Baptiste Denis <jbdenis@pasteur.fr> wrote:
>> --recstart and --recend are for --pipe. -d (and -0) is for normal use.
>
> OK. I'm not able to make it work :
>
> cat abc0-file | parallel --recend '\0' --pipe cat
> ABC$

This is exactly what I would expect: You have not given a --block, so
1 MB is used. This means all records will be read and given to a
single cat process which then outputs A\0B\0C\0.

When you give --pipe the command 'cat' (with -k) the result is the
same as the input no matter how you chop the records:

$ cat abc0-file | parallel --recend '\0' -N1 -k --pipe cat | md5sum
716774b53a92b98525bba179a159cc71  -
$ cat abc0-file |  md5sum
716774b53a92b98525bba179a159cc71  -
$ cat abc0-file | parallel --recend '\0' -k --pipe cat | md5sum
716774b53a92b98525bba179a159cc71  -

$ cat abc0-file | parallel --recend '\0' -N1 -k --pipe cat

Here we tell GNU Parallel to only pass a single record. So here you
get the output A\0 from one process and B\0 and C\0 from 2 other
processes in total: A\0B\0C\0 (which looks like ABC).

$ cat abc0-file | parallel --recend '\0' -N1 -k --pipe 'cat;echo {#}'
A\01
B\02
C\03

If you do not like the \0 in the output use --remove-rec-sep (--rrs):

$ cat abc0-file | parallel --rrs --recend '\0' -N1 --pipe 'cat;echo {#}'
A1
B2
C3

> I feel stupid.

It is still unclear to me what you try to accomplish.

If the above does not solve it, please give 3 examples of input with
the expected output.

If the above solved the issue, please help by rephrasing the
documentation, so that this is clear to you.


/Ole



reply via email to

[Prev in Thread] Current Thread [Next in Thread]