Thanks for the tip Ole! I will experiment with this flag. I tried to find the flag with the keyword "last", and didn't find anything useful, but I'm not a native english speaker, and that keyword might not be sensible to begin with, "latest" makes a lot of sense.
On Thu, Feb 20, 2025 at 7:10 PM Ole Tange <o...@tange.dk> wrote: > > On Fri, Jan 24, 2025 at 6:26 AM Glen Huang <hey...@gmail.com> wrote: > > > > Is it possible to make parallel run multiple commands > > > > $ parallel cmd ::: A B C > > > > And display the output as > > > > $ parallel cmd ::: A B C > > A: <last line from cmd A> > > B: <last line from cmd B> > > C: <last line from cmd C> > > > > Where the last line from each command output is always displayed > > in-place in real time at the same position, overwriting the previous > > line from the same command, and the name to identify each command is > > configurable by the user? > > What you describe sounds exactly as --latest-line: > > --latest-line > --ll > Print the latest line. Each job gets a single line that is updated > with the latest output from the job. > > Example: > > slow_seq() { > seq "$@" | > perl -ne '$|=1; for(split//){ print; select($a,$a,$a,0.03);}' > } > export -f slow_seq > parallel --shuf -j99 --ll --tag --bar --color slow_seq {} > ::: {1..300} > > See also: --line-buffer > > It will keep the oldest running job on the screen until it finishes. > So there may be younger jobs running that will only be visible when > that job ends. > > Run the example a few times. I find it oddly satisfying to watch. > > > I skimmed through the document, couldn't really find the answer. > > Wonder if it's possible at all? > > What words should be in the description so you would have found it? > > Did you look at > https://www.gnu.org/software/parallel/parallel_options_map.pdf? > > While that PDF looks messy (If you know how to penalize edge crossing > in Graphviz-Neato let me know - it would make it so much nicer), you > would look for an option similar to your use (e.g. --line-buffer) and > then look at what options are related to that. > > > /Ole