I have the below lines in a file
id=1234,name=abcd,age=76
id=4323,name=asdasd,age=43
except that the real file has many more tag=value
fields on each line.
I want the final output to be like
id,name,age
1234,abcd,76
4323,asdasd,43
I want all values before (left of) the =
to come out as separated with a ,
as the first row and all values after the (right side) of the =
to come below for in each line
Is there a way to do it with awk
or sed
? Please let me know if for loop is required for the same?
I am working on Solaris 10; the local sed
is not GNU sed
(so there is no -r
option, nor -E
).