Improved bdmap output again

master
BrainwreckedTech 3 years ago
parent 7e7284ea02
commit 22f37a041e

13
bdmap

@ -9,11 +9,14 @@ BLK_INFO="$(echo "${BLK_INFO}" | sed 's|\.\.\/devices/pci[0-9a-f:]\{7\}\(/[0-9a-
# STRIP OFF THE SUPERFLUOUS USB HOST INFORMATION # STRIP OFF THE SUPERFLUOUS USB HOST INFORMATION
BLK_INFO="$(echo "${BLK_INFO}" | sed 's|\(usb[0-9]\+\)/.*/host|\1/host|g')" BLK_INFO="$(echo "${BLK_INFO}" | sed 's|\(usb[0-9]\+\)/.*/host|\1/host|g')"
# STRIP OFF THE SUPERFLUOUS TARGET INFORMATION # STRIP OFF THE SUPERFLUOUS HOST AND TARGET INFORMATION
BLK_INFO="$(echo "${BLK_INFO}" | sed 's|/target\([0-9]\+\):\([0-9]\+\):\([0-9]\+\)/|/|g')" BLK_INFO="$(echo "${BLK_INFO}" | sed 's|/host[0-9]\+/target\([0-9]\+\):\([0-9]\+\):\([0-9]\+\)/|/|g')"
# EXPAND THE SCSI INFORMATION # EXPAND THE SCSI INFORMATION
BLK_INFO="$(echo "${BLK_INFO}" | sed 's|\([0-9]\+\):\([0-9]\+\):\([0-9]\+\):\([0-9]\+\)|ch\2/id\3/lun\4|g')" # BLK_INFO="$(echo "${BLK_INFO}" | sed 's|\([0-9]\+\):\([0-9]\+\):\([0-9]\+\):\([0-9]\+\)|ch\2/id\3/lun\4|g')"
# NORMALIZE NVME INFO
BLK_INFO="$(echo "${BLK_INFO}" | sed 's|nvme/nvme\([0-9]\+\)/nvme\([0-9]\+\)n\([0-9]\+\)|nvme/N:\2:\3:1|g')"
# STRIP OFF BLOCKS # STRIP OFF BLOCKS
BLK_INFO="$(echo "${BLK_INFO}" | sed 's|/block/.*||g')" BLK_INFO="$(echo "${BLK_INFO}" | sed 's|/block/.*||g')"
@ -42,8 +45,8 @@ echo "${BLK_INFO}" | while read -r LOCATION BLOCKDEV; do
else else
DEVICE_SZ="${DEV_BYTES}B" DEVICE_SZ="${DEV_BYTES}B"
fi fi
echo "${LOCATION} ${BLOCKDEV} ${DEVICE_SZ} ${DEVICE_ID}" >> /tmp/bdmap echo "${LOCATION} ${BLOCKDEV} ${DEVICE_SZ} ${DEVICE_ID}" | sed 's|/| |g' >> /tmp/bdmap
done done
column -t -R3 -o" " /tmp/bdmap column -t -R2,4 -o" " /tmp/bdmap
rm /tmp/bdmap rm /tmp/bdmap

Loading…
Cancel
Save