Converted repeated rows into splitted columns

Dear Friends,

I have an input file contains lot of datas, which is like repaeated rows report.

The output file need to have column wise report, rather than row-wise.

Input File
random line 1
random line 2
random line 3
-------------------------------------
Start line 1.1 (9.9)                                  20:33:03           Mon 07-26-2010
--------------------------------
config 		VM:  576 KB + 68/89 MB, TH 4 [TT 9+0] [T2 7+0]
File Name 	ui
File Size	123bytes

param	sl 1.00 x 1.90

Initial extent	(0.5)
changed 	(0.9)
-
-
-
--

-------------------------------------
Start line 1.1 (9.9)                                  24:31:03          Mon 07-26-2010
--------------------------------
config 		VM:  676 KB + 68/89 MB, TH 4 [TT 9+0] [T2 7+0]
File Name 	oi
File Size	456bytes

param	sl 1.01 x 1.90

Initial extent	(0.7)
changed 	(0.1)
-
-
-
--




Output required

COl1	TIME	 DATE	Config	FileName  	FileSize  	par
		
1.1(9.9)   20:33:03   Mon 07-26-2010   VM:--	ui 	123	S--
1.1(9.9)   24:31:03   Mon 07-26-2010     VM:..	oi      456   S --


Thanks in advance
Vasanth:confused:

Hi vasanth.v,

You can try with:

awk 'BEGIN{print "COl1|TIME|DATE|Config|FileName|FileSize|par"}
 {sub(/ \(/,"(")}
 /^Start line/{a=$3"|"$4"|"$5" "$6}
 /^config/{a=a"|"$2"--"}
 /File Name|File Size/{a=a"|"$3}
 /^param/{print a"|"$2"--";a=""}' inputfile
COl1|TIME|DATE|Config|FileName|FileSize|par
1.1(9.9)|20:33:03|Mon 07-26-2010|VM:--|ui|123bytes|sl--
1.1(9.9)|24:31:03|Mon 07-26-2010|VM:--|oi|456bytes|sl--

In order to avoid confuse fields, I've separate the output fields with |. If you need separated with spaces, please
replace every | with one space in the BEGIN line and replace every "|" with " "

Hope it helps,

Regards

1 Like