For sed - use double quotes around the variable.
For awk - use combination of double quotes single quotes double quotes
sed '/'"$pattern"'/d' filenameAnother option is to enclose entire sed command in double quotes.
sed "/$pattern/d" filenameFor awk - use combination of double quotes single quotes double quotes
awk '{ if ($(1) == "'"$pattern"'" ) {print $2}}'Optionally, you could create an awk variable from shell variable.
awk '{ if ($(1) == ipattern ) {print $2}}' ipattern=$pattern filename