Extract string between two characters

estrarre testo compreso tra due caratteri delimitatori non necessariamente uguali





For example I want to see mail boxes logins, each login row is similar to this:

Nov 26 12:17:52 sgherro_mail_server dovecot: imap-login: Login: user=<usermailbox>, method=PLAIN, rip=, lip=, TLS


To extract usermailbox I did this:

cat /var/log/mail.log | grep "Login: " |sed -nr 's/.*<(.*)>.*/\1/p'