I'm trying to insert text before a "matched regular expression". The only thing is, I need to match a variable after the regex. For example:
sed '/regex $var/i
str $var' filename;
This is one of many things I've tried. Does anyone know the correct way?