Formatting Bash output into one Table -
i have line of code produces first half of table. last half of table sizes hdd's . first code right now:
function getiscsi() { host in ${allhosts} ; 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}') in $alloracledev ; ( 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 looks 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 want table 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 stuff know bash knowledge bash script small :\ please?
you can save output 2 different files (file1, file2), , them paste them using paste.
paste file1 file2
or can directly on fly:
paste <( command1 ) <( command2 )
Comments
Post a Comment