bash – Adding columns from another command by name (1st column)


I have the following two commands and their outputs, for example:

1) kubectl top pods 

NAME                                                              CPU(cores)   MEMORY(bytes)
am-cbkc-plugin-55b9df956f-sh82g                                   3m           923Mi
amd-apigw-stack-6df456664f-sbdvc                                  3m           491Mi

2) kubectl get pods -o=custom-kubectl get pods -o=custom-columns=",CPULIM:spec.containers[*].resources.limits.cpu,MEMLIM:spec.containers[*].resources.limits.memory"
NAME                                                              CPULIM   MEMLIM
am-cbkc-plugin-55b9df956f-sh82g                                   1        2Gi
amd-apigw-stack-6df456664f-sbdvc                                  550m     4Gi

How can I combine the columns based on the “NAME” column?

NAME   CPU(cores)   MEMORY(bytes)  CPULIM   MEMLIM


Read more here: Source link