AWK script to parse a data in a file

Hi Unix gurus..

I have a file which has below data, It has several MQ Queue statistics;

QueueName= 'TEST1'
CreateDate= '2009-10-30'
CreateTime= '13.45.40'
QueueType= Predefined
QueueDefinitionType= Local
QMinDepth= 0
QMaxDepth= 0
QueueName= 'TEST2'
CreateDate= '2009-10-30'
CreateTime= '13.51.12'
QueueType= Predefined
QueueDefinitionType= Local
QMinDepth= 0
QMaxDepth= 6

My output should be as below, each queue details should be displayed in a single line delimited by space,

QueueName= 'TEST1' CreateDate= '2009-10-30' CreateTime= '13.45.40' QueueType= Predefined QueueDefinitionType= Local QMinDepth= 0 QMaxDepth= 0
QueueName= 'TEST2' CreateDate= '2009-10-30' CreateTime= '13.51.12' QueueType= Predefined QueueDefinitionType= Local QMinDepth= 0 QMaxDepth= 6

thanks in advance..

awk 'BEGIN{ORS=FS}/^QueueName/{if(NR>1)$0=RS$0}1; END{print RS}' inputfile

Also have a look at paste command.

paste -s inputfile

Serial merging will not work here..will generate a single line...check the OP's requirement again.

Here is an alternate way:

awk '{if($0~/^QMax/)s="%s\n";else s="%s ";printf s,$0}' inputfile

Paste will work but you have to pass in the list of delimiters...

$ paste -s -d '      \n' file1
QueueName= 'TEST1' CreateDate= '2009-10-30' CreateTime= '13.45.40' QueueType= Predefined QueueDefinitionType= Local QMinDepth= 0 QMaxDepth= 0
QueueName= 'TEST2' CreateDate= '2009-10-30' CreateTime= '13.51.12' QueueType= Predefined QueueDefinitionType= Local QMinDepth= 0 QMaxDepth= 6

Thanks a lot every one.. appreciate your help..