Comment

Comment by vimax

A fun trick is using the `paste` command with process substitution to combine lines of output from different commands.

  ./cmd1
outputs:

  a
  b
  c

  ./cmd2
outputs:

  1
  2
  3

  paste <(./cmd1) <(./cmd2)
outputs:

  a 1
  b 2
  c 3

You can then use xargs to use each line as arguments for another command:

  paste <(./cmd1) <(./cmd2) | xargs -L1 ./cmd3
calls:

  ./cmd3 a 1
  ./cmd3 b 2
  ./cmd3 c 3
parent vimax 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton