# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/^(lib32-[a-zA-Z0-9\.\-]*?)\-[0-9\.]*\-[0-9\.]$//gm;t' <<< "lib32-bluez-libs-5.41-1
lib32-dbus-glib-0.106-1
lib32-gconf-3.2.6-1
lib32-jansson-2.7-2
lib32-kmod-22-1
lib32-libdaemon-0.14-4
lib32-libical-2.0.0-3
lib32-libmbim-1.12.4-1
lib32-libmm-glib-1.4.14-2
lib32-libndp-1.6-1
lib32-libnm-glib-1.2.2-1
lib32-libqmi-1.12.10-1
lib32-libteam-1.23-1
lib32-libudev0-182-2"
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html