awk delete newline after other replacements

Dear All,

could you please help me to remove \n characters after all other replacements have been done as in the code below:

{

#remove punctuation and starting whitespaces
  gsub("[[:punct:]]"," ");
  $1=$1;
}
{
#print lines containing 'whatever'
  if ($1=="whatever")
  {print}
#print lines longer then 150 chars 
 else if (length($0) > 150)
  {print}
}
{
#does not work - need to get rid of all \n and then replace 'whatever' with \n
gsub("[\n]"," ");
{print}
}

Thank you for your great expertise.

You might have hit the side of the box, this is a line oriented tool. Do you want to merge some lines or remove all linefeeds? Command "tr -d '\12'" removes all linefeeds.

Thank you. I wanted to go AWK only and figured out to put -ORS " " to remove newline chars from output. This is a partial solution, thought.

Both awk and sed can read the next line or additional lines into the buffer so you can evaluate if you want to preserve the linfeed between those lines. I once wrote a sed to take whole pages and turn them into lines by reversing the new line and form feed. Then another sed could turn the pages into insert statements. Finally, I turned the form feeds back into new lines, so the displayed page from the db would be correct. The DB allowed 32k char().