sed: perform substitution in back reference

I’m using the follwing line to produce part of an HTML list:

sed -r 's|(.*dn=([^&]+).*)|<li><a href=""></a></li>|' file.txt

And I’d like to perform more substitutions, but only on the backreference, not the whole line. Is that possible, and how?

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.