SED multiple pattern matching

Hello sorry for the probably simple question - searching about the forums and Internet, I have not found the answer.

Could you tell me please how to do a multiple pattern match with SED

So it would be SED searching for "PATTERN1" 'or' "PATTERN2" not 'and' if they happen to fall on the same line well that is ok to.

so far I have this from the Internet

sed -e '/PATTERN1/b' -e '/PATTERN2/b' -e d

Is there a better way of writing this? I would like to search on paragraphs containing PATTERN1 or PATTERN2 and delete a blank line. The below SED works for one PATTERN but I would like to search for a possible occurrence of PATTERN2 aswell incase it is there.

sed '/PATTERN/{N;s/\n//;}' 

would something like this work for searching PATTERN1 or PATTERN2

sed -e '/PATTERN1/{N;s/\n//;}d; -e /PATTERN2/{N;s/\n//;}d' filename

Thanks in advance

I think you are close, if I understand what you want to do.

What I think your goal is: when there is a record of text which contains either pattern1 or pattern2, you want to delete the blank line that follows. This is a slight change to your sed script which should do that:

sed -e '/pattern1/{N;s/\n\n/\n/;}'  -e '/pattern2/{N;s/\n\n/\n/;}' file

There is no need for the delete, and it handles the case where the matching record is NOT followed by a blank line. It does this by replacing two consecutive newlines (after the read of the next line by the N command) with a single newline. If the next line isn't "blank," things are unchanged.

Thankyou very much
Will that change do the same for all instances of those patterns searched?
In the files I search, there are many instances of one or the other of the patterns, I assume this will progress through the entire file?

Thankyou for taking the time to reply, this helped greatly. I will try this on the server script I am running.
Regards

You are correct, it will apply the change to each record in the file with either of the patterns.

Many thanks again Agama
Regards