That's great—thanks so much!
-- Coby


On Sat, July 1, 2017 12:22 am, Ole Tange wrote:

> On Sat, Jul 1, 2017 at 1:56 AM, Coby Viner
<[email protected]> wrote:

>

>> Is it possible to use --colsep with multiple input files, without
having

>> to

>> manually prefix each files' header by a unique identifier for use
in

>> conjunction with --header?

>

> Yes.

>

>> For example, it would be nice if with multiple files they could
be

>> automatically labelled with a–z, with numerals still
referring to their

>> columns (the reverse strikes me as better, but that would be

>> counter-intuitive given the present implementation).

>

> The current implementation numbers the total amount of columns. In

> your case {1}, {2}, {3} and {4}.

>

> Nice thing about this is that negative number and all --rpl
strings

> starting with '{' work, too. Here we lowercase column 3 (second to

> last = -2):

>

> $ parallel --rpl '{lowercase} $_=lc($_)' --colsep '\t' "echo
f1={1}

> f2={2} g1={-2 lowercase} g2={4}" :::: <(perl -e 'printf

> "f1\tf2\nA\tB\nC\tD\n"') :::: <(perl -e 'printf

> "g1\tg2\nE\tF\nG\tH\n"')

>

>> I would ideally like to be able to do the following:

>>

>> parallel --colsep "echo f1={a1} f2={a2} g1={b1}
g2={b2}" :::: <(perl -e

>> 'printf "f1\tf2\nA\tB\nC\tD\n"') :::: <(perl -e
'printf

>> "g1\tg2\nE\tF\nG\tH\n"')

>>

>> Currently, the use of --colsep without --header for multiple
files does

>> not

>> behave as I would have expected:

>>

>> parallel --colsep '\t' "echo f1={1} f2={2} g1={1}
g2={2}" :::: <(perl -e

>> 'printf "f1\tf2\nA\tB\nC\tD\n"') :::: <(perl -e
'printf

>> "g1\tg2\nE\tF\nG\tH\n"')

>> f1=f1 f2=f2 g1=f1 g2=f2

>> f1=f1 f2=f2 g1=f1 g2=f2

>> f1=f1 f2=f2 g1=f1 g2=f2

>> f1=A f2=B g1=A g2=B

>> f1=A f2=B g1=A g2=B

>> f1=A f2=B g1=A g2=B

>> f1=C f2=D g1=C g2=D

>> f1=C f2=D g1=C g2=D

>> f1=C f2=D g1=C g2=D

>

> Try using {3} and {4}:

>

> parallel --colsep '\t' "echo f1={1} f2={2} g1={3} g2={4}"
:::: <(perl

> -e 'printf "f1\tf2\nA\tB\nC\tD\n"') :::: <(perl -e
'printf

> "g1\tg2\nE\tF\nG\tH\n"')

>

> I have updated the man page:

>

> --colsep regexp

> -C regexp

> Column separator. The input will be treated as a table

> with regexp separating the columns. The n'th column can

> be access using {n} or {n.}. E.g. {3} is the 3rd column.

>

> If there are more input sources, each input source will

> be separated:

>

> parallel --colsep ',' echo {4} {3} {2} {1} ::: "A,B" :::

> "c,d"

>

> --colsep implies --trim rl, which can be overridden with

> --trim n.

>

> regexp is a Perl Regular Expression:

> http://perldoc.perl.org/perlre.html

>

> /Ole

>
 

Reply via email to