From 22f37a041e75ad6501192e56aa6eac7afa016ec8 Mon Sep 17 00:00:00 2001 From: BrainwreckedTech <3752022+BrainwreckedTech@users.noreply.github.com> Date: Mon, 10 Jan 2022 23:07:40 -0500 Subject: [PATCH] Improved bdmap output again --- bdmap | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bdmap b/bdmap index 944bdff..7221f2e 100755 --- a/bdmap +++ b/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 BLK_INFO="$(echo "${BLK_INFO}" | sed 's|\(usb[0-9]\+\)/.*/host|\1/host|g')" -# STRIP OFF THE SUPERFLUOUS TARGET INFORMATION -BLK_INFO="$(echo "${BLK_INFO}" | sed 's|/target\([0-9]\+\):\([0-9]\+\):\([0-9]\+\)/|/|g')" +# STRIP OFF THE SUPERFLUOUS HOST AND TARGET INFORMATION +BLK_INFO="$(echo "${BLK_INFO}" | sed 's|/host[0-9]\+/target\([0-9]\+\):\([0-9]\+\):\([0-9]\+\)/|/|g')" # 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 BLK_INFO="$(echo "${BLK_INFO}" | sed 's|/block/.*||g')" @@ -42,8 +45,8 @@ echo "${BLK_INFO}" | while read -r LOCATION BLOCKDEV; do else DEVICE_SZ="${DEV_BYTES}B" fi - echo "${LOCATION} ${BLOCKDEV} ${DEVICE_SZ} ${DEVICE_ID}" >> /tmp/bdmap + echo "${LOCATION} ${BLOCKDEV} ${DEVICE_SZ} ${DEVICE_ID}" | sed 's|/| |g' >> /tmp/bdmap done -column -t -R3 -o" " /tmp/bdmap +column -t -R2,4 -o" " /tmp/bdmap rm /tmp/bdmap