# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/SSR.(....)(.BE.)(\w+)(-1)(\w+)(\\/)(\w+).*/\1-\5-\7/gm;t' <<< "SSR BAGW BE HK1DUBEXT0304H13OCT-1TIMBRELL/TEGAELAMISS.1P/AUTH 23KG
SSR BAGA BE HK1DUBLON0301H13NOV-1TIMBRELL/TEGAELAMISS.1P/AUTH 23KG
SSR DOCS BE HK1DUBEXT0204H13DEC-1TIMBRELL/TEGAELAMISS
SSR PETC BE HK1LONEXT0334H13JAN-1TIMBRELL/TEGAELAMISS
SSR WCHR BE HK1DUBEXT0204H13DEC-1TIMBRELL/TEGAELAMISS
SSR BAGW BE HK1DUBLON0301H13NOV-1TIMBRELL/TEGAELAMISS.1P/AUTH 23KG
BE7351 H 08NOV18MANMXP HK4/11251440
BE2108R/VS8508Y 11NOV18LHREDI HK10/18202000
A97351 H 08NOV18MANMXP HK4/11251440"
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