[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tagging output
From: |
Ole Tange |
Subject: |
Re: Tagging output |
Date: |
Mon, 22 Aug 2011 16:07:56 +0200 |
On Sun, Aug 21, 2011 at 5:12 PM, Bertelson, Tom (GE, Corporate,
consultant) <Tom.Bertelson1@ge.com> wrote:
> I'm migrating some home-grown parallel processing scripts to GNU parallel.
> One feature I miss from the old scripts is the ability to tag each line of
>output, so you can see exactly what produced them.
>
> A simple example:
>
> $ parallel 'find {} -print | wc -l' ::: /etc /usr/local
> 4161
> 3792
> $ parallel --tag 'find {} -print | wc -l' ::: /etc /usr/local
> /usr/local: 4161
> /etc: 3792
> $
>
> Is there a way to easily do this with parallel? I cobbled together a "--tag"
> option to get me by (and I'd be happy to share), but I'd prefer to not
> maintain any local patches.
The obvious answer in for the example you show is:
parallel 'echo -n {}:; find {} -print | wc -l' ::: /etc /usr/local
Normally I need the output in separate files:
parallel 'find {} -print | wc -l > {/}.out' ::: /etc /usr/local
Personally I do not see much use of the option, and I refuse to
implement options that do now have well documented generally useful
use cases or which is wanted by less than 3 users.
You should, however, not see that a 'no'. See it as a challenge to
produce some really cool examples of what you could do with that
option that you cannot do today (or which is hard/bothersome).
I try to make GNU Parallel deal reasonable with corner cases, too. So
you should also think of:
* what should happen if the arguments contained: \t : space \n
* should the separator be configurable?
* should stdout/stderr be treated differently?
* are there any issues on systems that have different line separator
(Think of Windows)?
/Ole
- Tagging output, Bertelson, Tom (GE, Corporate, consultant), 2011/08/22
- Re: Tagging output,
Ole Tange <=