I'VE POSTED AN ANSWER TO THIS BELOW... PLEASE FIND IT. FEEL FREE TO OPTIMIZE IT IF YOU CAN :).

So a brief description of the problem: I've created a file with a massive output from a psql query, and I'm trying to use this data but the format of the output is not ideal. Here is a breakdown of what the data looks like:

> 
> some\_date | some\_username | some\_port | **statement:**
> 
> 
> **: SELECT some\_query**
> 
> 
> some\_date | some\_username | some\_port | statement: SELECT some\_different\_query
> 
> 
> 

Thats what the data looks like, and the problem is the bold line. I have no idea why that statement is split across two lines like that, but it's screwing with the rest of the processing that I need to do. If I look at the characters in bold section only, it's as follows:

> 
> statement:>$
> 
> 
> :> query$
> 
> 
> 

Where `>` is whitespace and `$` is an eol character.

So I really need to join those two lines together, but I have no idea how. This is what I've tried so far:

```
sed 's/\n://g' filename

```

That doesn't work, obviously. Makes sense too, because SED works on a line to line basis I believe. Any suggestions will be gladly appreciated.

Below is a screenshot of the data. I can't copy the data as my VM won't allow it out. Sorry...

[![enter image description here](https://i.stack.imgur.com/ZIAUN.png)](https://i.stack.imgur.com/ZIAUN.png)

Below is how I'd like this data to look... Try with your awk :P:

[![enter image description here](https://i.stack.imgur.com/SQbtw.png)](https://i.stack.imgur.com/SQbtw.png)