Formatting a file

Hi All,

I have been trying to format a file using sed. I can't seem to get the syntax right. I want to append the next line delemited by a comma or a comma and double quotes. Here is an example of the file I'm tring to format:

Before formatting:

00324
03A0312
BRI-u24
0000324
01
H-12
KKG

00325
03A0312
BRI-u25
0000325
02
H-13
KKG

00326
03A0313
BRI-u26
0000326
03
H-14
KKG

After formatting:

00324, 03A0312, BRI-u24, 0000324, 01, H-12, KKG
00325, 03A0312, BRI-u25, 0000325, 02, H-13, KKG
00326, 03A0313, BRI-u26, 0000326, 03, H-14, KKG

or

"00324" , "03A0312" , "BRI-u24" , "0000324" , "01" , "H-12" , "KKG"
"00325" , "03A0312" , "BRI-u25" , "0000325" , "02" , "H-13" , "KKG"
"00326" , "03A0313" , "BRI-u26" , "0000326" , "03" , "H-14" , "KKG"

nawk -v OFS=, -v RS='' '$1=$1' myFile.txt
OR
nawk -v OFS=, -v RS='' '{for(i=1;i<=NF;i++) gsub(/.*/,"\"&\"", $i); print}' myFile.txt

Thank you vgersh99! The nawk commands worked perfectly. I have been trying all day to do the same thing with sed.

Hi all..

can anybody explain what that the above nawk does .. I understand that is doing format .. Please explain with that awk command ..

Thanks,
Arun.

BEGIN { RS=""; q="\""; OFS= q "," q }
{ $1=$1 ; print q $0 q }