parallel
[Top][All Lists]
Advanced

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

-0/--null behavior with --pipe


From: Jean-Baptiste Denis
Subject: -0/--null behavior with --pipe
Date: Fri, 20 Apr 2018 13:51:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hello everybody,

I'm wondering if I'm missing something about -0/--null behavior with --pipe. I don't seem to be able to split stdin on NUL from a command. Here is an example:

$ parallel --version
GNU parallel 20180322

Let's generate two files, once with newline separator and the other one with \0:

$ parallel -k echo ::: A B C > abc-file
$ cat abc-file
A
B
C
$

$ perl -e 'printf "A\0B\0C\0"' > abc0-file
$ cat abc0-file
ABC$

I want to run a (cat) command spreading each record in abc-file on its stdin:

$ cat abc-file | parallel -N1 --pipe cat
A
B
C
$

3 cat commands are generated:

$ cat abc-file | parallel -N1 --dry-run --pipe cat
cat
cat
cat
$

But I can't make it work with abc0-file:

$ cat abc0-file | parallel -N1 -0 --pipe cat
ABC$

Only one command is generated:

$ cat abc0-file | parallel -N1 -0 --pipe --dry-run cat
cat$

If I don't use --pipe, records are correctly splitted using the NUL separator :

$ cat abc0-file | parallel -N1 -0 echo
A
B
C
$

$ cat abc0-file | parallel -N1 -0 --dry-run echo
echo A
echo B
echo C
$

What do you think ?

Thank you for your help,

Jean-Baptiste








reply via email to

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