Depending on the data, the right options for xargs would work, and there's the pr command I haven't used much.
“(at 0 {})” would be a nice construction.
But then of course now you’re writing xargs -n 2 -I {} echo (at 1 {}) instead of just awk {print $2}, so it’s mission failed successfully.
$ paste <(printf "a\nb\nc\n") <(printf "1\n2\n3\n") | cut -f2
1
2
3
It makes sense that "cut" and "paste" would be inverse operations, but too bad that GUIs repurposed these words for clipboard operations.But awk can do both, and does so in a single pass:
$ paste <(printf "a\nb\nc\n") <(printf "1\n2\n3\n") | awk '{ print $1 > "letters"; print $2 > "numbers" }'
$ cat letters
a
b
c
$ cat numbers
1
2
3Thanks!
gawk documentation: https://web.mit.edu/gnu/doc/html/gawk_6.html#SEC41
posix documentation: https://pubs.opengroup.org/onlinepubs/009695299/utilities/aw...
paste <(printf "a\nb\nc\n") <(printf "1\n2\n3\n") | while
read x y; do echo "$y -- $x"; doneKinda silly for this example, but very useful in things like `kubectl` pipelines -- you can do something like this:
kubectl get pods --all-namespaces | awk '{print $1 " " $2}' | grep "doesntexist" | while read x y; do kubectl delete pod $y --namespace $x --wait=false; done
This lets you list all pods in a cluster, grep a selection of them by name, and delete them in a batch, regardless of which namespace they are in, while shuffling the order of args into different flags.