I'm trying to join similar groups of lines in to a single line. My file is a basic log-type file, but each entry spans three lines followed by a newline. Example:
Timestamp
key1 | val1 | key2 | val2
key3 | val3 | key4 | val4
Timestamp
key1 | val1 | key2 | val2
key3 | val3 | key4 | val4
What I would like is for each block of 3 lines to be on a single, comma-separated line:
Timestamp,key1,val1,key2,val2,key3,val3,key4,val4
I could do this with sed&awk if I only had to deal with the key/value lines, but my problem is with getting the timestamp on each line.
Things I've looked at are using xargs and paste but neither seemed to do what I needed them to do.