As part of an automation I had to collect only the name and size of the multi-path devices attached to a given VM. Here is the result:
multipath -ll | sed -n ‘/^mpath/,/^size/p’ >> /tmp/mpath.log && x=1 && while IFS=”” read -r p || [ -n “$p” ]; do STR1=$(printf ‘%s\n’ “$p” | sed ‘s/\s.*$//’); STR2+=$STR1″ “; y=$(($x % 2)); if [ $y -eq 0 ]; then printf ‘%s\n’ “$STR2”; echo “—“; STR2=””; fi; x=$(( $x + 1 )); done < /tmp/mpath.log; rm -f /tmp/mpath.log; touch /tmp/mpath.log;
You can also get if from here https://gist.github.com/rpsene/41ade69f9ff493b0f26c66963b3d8502