I have this line of Code which produces the first half of my table. The last half of the Table are the Sizes from the hdd's . So first this is my code right now:

function getiSCSI() {
    for host in ${allhosts} ; do
        HOSTID="$( echo "${host}" | awk -F, '{print$1}' )"
        CSV_FQDN="$( echo "${host}" | awk -F, '{print$2}' )"
        ALLORACLEDEV=$(ssh -x -l root ${CSV_FQDN} '/sbin/multipath -ll'  | grep NETAPP|awk '{print $2}')
        for i in $ALLORACLEDEV ; do 
            ( ssh -x -l root ${CSV_FQDN} "fdisk -l /dev/$i|grep GB" |awk '{print $3,$4}'
                )
            done ;ssh -x -l root ${CSV_FQDN} "ls -l /dev/oracleasm/disks/|grep dm-[0-9]"|awk '{print $11, $9}'|cut -d/ -f3

    done #2>/dev/null #| ${GENHTML_CMD}

}

The output right now looks like this:

107.4 GByte,
107.4 GByte,
107.4 GByte,
107.4 GByte,
107.4 GByte,
107.4 GByte,
107.4 GByte,
107.4 GByte,
107.4 GByte,
dm-18 arch01
dm-16 na2lun01
dm-17 na2lun02
dm-21 na2lun03
dm-19 na2lun04
dm-20 na2lun05
dm-22 na2lun06
dm-23 na2lun07
dm-28 na2lun08

But i want the table like this:

dm-18 arch01   107.4 GByte
dm-16 na2lun01 107.4 GByte
dm-17 na2lun02 107.4 GByte
dm-21 na2lun03 107.4 GByte
dm-19 na2lun04 107.4 GByte
dm-20 na2lun05 107.4 GByte
dm-22 na2lun06 107.4 GByte
dm-23 na2lun07 107.4 GByte
dm-28 na2lun08 107.4 GByte

I tried all the Stuff i know about bash but my knowledge about bash script is very small :\ Could you help please?

有帮助吗?

解决方案

You can save your output to two different files (file1, file2), and them paste them together using paste.

paste file1 file2

Or you can do it directly on the fly:

paste <( command1 ) <( command2 )
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top