From 97c1893dce92d8bf823aa58b37ec1a476b9ad302 Mon Sep 17 00:00:00 2001 From: llnu Date: Wed, 27 May 2020 20:13:39 +0200 Subject: [PATCH] [map-osd-to-disktype] improved formatting, printf fixed size, so the columns match every time! (probably will have a bug if we reach 99+ osds) --- map-osd-to-disktype | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/map-osd-to-disktype b/map-osd-to-disktype index 43a7a29..7bafb75 100755 --- a/map-osd-to-disktype +++ b/map-osd-to-disktype @@ -18,11 +18,11 @@ for MOUNT in $(cat /tmp/list_osd_mountpoint.out | awk '{print $1}' | sed 's/[0-9 for megacli_mappings in $(cat /tmp/megacli-mappings.out); do awk '/Disk info/,0' /tmp/megaclisas-status.out | grep -w "$megacli_mappings"p0 | cut -d '|' -f 2-6,8 >> /tmp/disk_types.out; done # Formatting, to get the local $OSDTYPE osd-s -for osd_num in $(cat /tmp/list_osd_mountpoint.out | awk '{print $2}' | cut -c 24- ); do echo osd-$osd_num >> /tmp/local_osds.out; done +for osd_num in $(cat /tmp/list_osd_mountpoint.out | awk '{print $2}' | cut -c 24- ); do printf "%-7s%s\n" "osd-$osd_num" >> /tmp/local_osds.out; done # Combine and display the outputs -paste /tmp/local_osds.out /tmp/disk_types.out +paste /tmp/local_osds.out /tmp/disk_types.out -d '|' # Cleanup *.out files in the temp dir -rm /tmp/*.out +#rm /tmp/*.out