Could you suggest a sed/awk command to merge lines in a file that start with a pattern and ends with a brackets; the matching is of variable line numbers and governed with closing bracket.

eg For the following input, the extraction pattern has pattern1 as the begining and ends with '}'

```
blah blah
pattern1 {
blah blah 1
blah blah 2
blah blah 3
}
pattern1 {
blah blah 1
blah blah 2
}

```

the expected output is 

```
blah blah 
partern1 {blah blah 1 blah blah 2 blah blah 3}
partern1 {blah blah 1 blah blah 2}

```