Shell script to convert rows to columns

Hi

I have a file having the values like below

----------------------------

.set A
col1=�ABC�
col2=34
col3=�DEF�
col4=�LMN�
col5=25
.set A
.set B
col1=55
col3=�XYZ�
col4=�PQR�
col5=66
.set B
.set C
col2=�NNN�
col5=�MMM�
.set C

---------------------------------------------
I want the output file as below

-------------------------------------------

col1;col2;col3;col4;col5
ABC;34;EDF;LMN;25
55;;XYZ;PQR;66
;NNN;;;MMM

----------------------------------------------
So can someone help me how to get the desired output using UNIX Shell scripting.

Welcome Suneel Mekala,

I've moved this thread to a general forum rather than the "Contact Administrators" one. Please consider where you are posting. Additionally, please wrap code and data input/output in CODE tags, like this:-

to produce the following (fixed character width, space respected):-

This is my code

It makes it far easier to read. I have adjusted your submission for you this time.

As to your question, I have a few to pose in response first:-

  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)

Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.

We're all here to learn and getting the relevant information will help us all.

Thanks, in advance,
Robin
Lancashire, UK