Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A simple way to get only the name and size of multipath devices.
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment