Question: I have a list that looks like this:

```
>aaa(+)
AAAAAAAAAA
>bbb(+)
BBBBBBBBBBBBBBBB
>ccc(-)
CCCCCCC

```

And I want to use awk to join the next line after either '(+)' or '(-)', with a comma delimiter, so that it looks like this:

```
>aaa(+),AAAAAAAAAAA
>bbb(+),BBBBBBBBBBBBBBBB
>ccc(-),CCCCCCC

```

I have already tried the following (in bash):

```
cat $file | awk '/(-)/||/(+)/{if (x)print x;x"";}{x=(!x)?$0:x","$0;}END{print x;}' > $new_file

```

but this appears to give a result like this:

```
>aaa(+),AAAAAAAAAAA
>aaa(+),AAAAAAAAAAA,>bbb(+),BBBBBBBBBBBBBBBB
>aaa(+),AAAAAAAAAAA,>bbb(+),BBBBBBBBBBBBBBBB,>ccc(-),CCCCCCC

```

which is obviously not what I am trying to do.

Any help would be very appreciated!

Thanks

Answer: 
This awk one-liner should work for your example:

```
awk '/^>/{printf "%s,",$0;next}7' file

```

It joins the line beginning with `>` with the line below it. If the `(+/-)` is the key, you can change the pattern to your interested key.
```
paste -d, - - < file

```

Paste will do the job if your file consists entirely of pairs of lines, as in your example.