parallel
[Top][All Lists]
Advanced

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

Re: parallel treats input as a single token


From: Ole Tange
Subject: Re: parallel treats input as a single token
Date: Fri, 23 Nov 2012 22:31:01 +0100

On Thu, Nov 22, 2012 at 4:22 PM, John <da_audiophile@yahoo.com> wrote:
> I have a bash script that expects three tokens that I'd like to push through 
> parallel.  The problem I am experiencing is that when I cat a text file and 
> pipe it into parallel, the spaces in the tokens are not treated as such; they 
> are treated as a single token.

That is by design. We want a full line to be quoted as a single token
unless the user explicitly tells otherwise.

> Here is a simplified script: ~/bin/action
> #!/bin/bash
> echo "first = $1"
>
> echo "second = $2"
> echo "third = $3"
>
> If I simply run it like so, I get the expected output:
>
> % ~/bin/action a b c
> first = a
>
> second = b
> third = c
>
> So to use parallel, I place the "a b c" into a text file that I cat and pipe 
> into parallel but all of the tokens become $1 as you can see:
>
> % echo "a b c" > worklist
> % cat worklist | parallel ~/bin/action
> defined(@array) is deprecated at /usr/bin/parallel line 211.
> (Maybe you should just omit the defined()?)
> first = a b c
> second =
> third =
>
> 1) Please help me understand the error of my way.

You do not write if you have watched the intro videos and read the
examples in the man page. Please do that with empasis on
http://www.gnu.org/software/parallel/man.html#example__use_a_table_as_input


/Ole



reply via email to

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