I already knew sed\'s \\1, \\2, ... , \\n and recently discovered that it has a useful \\U option to create
sed
\\1
\\2
\\n
\\U
Quite possibly you want one of these fine GNU sed document sections: