Hi Ambrose. Please use [email protected] for support (unless you are interested in hiring me for support).
You should read the man page about --colsep and --xapply. If this does not answer your question, feel free to post on the mailing list. /Ole On Wed, Mar 27, 2013 at 4:20 AM, Ambrose Kofi Laing <[email protected]> wrote: > Dear Ole, > > I have recently discovered Gnu Parallel, and I have a use case which I have > not seen addressed in the documentation: > > Suppose I have a file like this: > > VeryLongNameA A > VeryLongNameD D > VeryLongNameM M > > etc. > > [Note: this is a case where there is no VeryLongNameB B pair, and so I just > have to list what I actually do have in a file. There is no pattern like a > for all values in set 1, and for all values in set 2. > Moreover, I also don't want VeryLongNameA to pair with D or M.] > > I want to do substitutions and {} will get the full line including the space > (I believe). What I need is something like (I'm making up a new syntax for > this question) {&1} and {&2} where for a given line {&1} will be > "VeryLongNameA" and {&2} will be "A". And when we read the next line, then > they will change to VeryLongNameD and D respectively, and so on. Ideally > the syntax would work for many columns not just two. > > Note that the pattern is not regular enough that I can use your current > meaning of {1} and {2} which I believe are for generating something like a > cross product where {1} ranges over a certain set, and {2} ranges over a > different set and you get all the possible combinations / pairs. > > The actual command I want it to expand to is something similar to: > > run_my_command VeryLongNameA.jpg < A.gif > A.log > > and I wanted to write something like > > run_my_command {&1}.jpg < {&2}.gif > {&2}.log > > or something like that. Is this feature supported (with a different > syntax)? > > Secondly if it is not supported, I have tried just writing the arguments > above onto each line of the input file like so: > > VeryLongNameA.jpg < A.gif > A.log > VeryLongNameD.jpg < D.gif > D.log > ... > > And then my command is simply: run_my_command {} > > That is not working for some reason. Is it obvious to you why that would > not work? I'm thinking it might have something to do with putting the > redirect commands into the file. > > Thanks, I'd appreciate any help you can give, > > Ambrose > >
