Thanks for the quick reply Hans, That's not exactly what I was looking for.
cmd.sh shouldn't clip output itself. I want parallel to do that, but as cmd.sh produces more lines, I want parallel to display the last line *in realtime* as each cmd.sh invocation produces more lines. On Fri, Jan 24, 2025 at 2:29 PM Hans Schou <ch...@schou.dk> wrote: > > On Fri, 24 Jan 2025, Glen Huang wrote: > > > And display the output as > > > > $ parallel cmd ::: A B C > > A: <last line from cmd A> > > If cmd is "seq" and you put it in a script cmd.sh > then it is. > > Script cmd.sh: > #! /bin/bash > seq $1 | tail -n 1 | sed "s/^/$1: /" > > parallel ./cmd.sh ::: 3 4 5 > > seq $1: prints numbers from 1 to $1 > tail -n 1: display last line > sed "s/^/$1: /": prefix line with "$1: " > > -- > > ./hans >