我有这行代码,它产生了我表的前半部分。表的后半部分是硬盘的大小。所以首先这是我现在的代码:
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}
}
现在的输出如下所示:
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
但我想要这样的表:
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
我尝试了所有关于 bash 的知识,但我对 bash 脚本的了解非常少:\ 你能帮忙吗?