I have a string like this one:
# pap
which basically translates to a \\t#\\n\\tpap and I want to replace it with:
\\t#\\n\\tpap
try this line with gawk:
awk -v RS="\0" -v ORS="" '{gsub(/\t#\n\tpap/,"yourNEwString")}7' file
if you want to let sed handle new lines, you have to read the whole file first:
sed
sed ':a;N;$!ba;s/\t#\n\tpap/NewString/g' file