# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/(?:\G(?!\A)|^(?!.*\.join\.))(.*?)PD_/$1/gm;t' <<< "it.mycompany.db.beans.str1.PD_T_PD_CLASS
it.mycompany.db.beans.join.PD_T_CLASS
it.mycompany.db.beans.str2.PD_T_CLASS_1
it.mycompany.db.beans.join.PD_T_CLASS_1
PD_T_CLASS myVar = new PD_T_CLASS();
myVar.setPD_T_CLASS(something);"
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