[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GNU Parallel Bug Reports [Feature request] easily refer to the last colu
From: |
Thor Andreassen |
Subject: |
GNU Parallel Bug Reports [Feature request] easily refer to the last column of input |
Date: |
Tue, 12 Feb 2013 15:23:45 +0100 |
Hi,
I've been using GNU parallel for a while now and I like it a lot.
I came across a problem today, that, besides awk, would be a good fit
for GNU parallel. For example, given the following input (infile):
1 4 5 1
2 3 5 2
7 8 6 3
Add column 2 and the last column, not knowing how many columns there
will be, and append the result to the output.
The output in this case should be:
1 4 5 1 5
2 3 5 2 5
7 8 6 3 11
With my experience from perl arrays I hoped I could refer to the last
column with {-1}, e.g. with parallel and bash:
<infile parallel --colsep ' +' echo '{}' '$(( {2} + {-1} ))'
I've looked for the relevant bit in the source code, but so far I've
been unable to find it.
--
best regards
Thor Andreassen
- GNU Parallel Bug Reports [Feature request] easily refer to the last column of input,
Thor Andreassen <=