Hi All,
My Input data is:
A=1
B=2
My desired Output should be:
A|B
1|2
Thanks in advance...
Hi All,
My Input data is:
A=1
B=2
My desired Output should be:
A|B
1|2
Thanks in advance...
awk -F '=' '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str"|"a[i,j];
}
print str
}
}' data
The Input and Output:
A=23
B=43
C=87
D=65
A|B|C|D
23|43|87|65
Output is coloured blue.
$ cat inputfile
A=1
B=2
C=3
$ perl -F"=" -lane 'chomp $F[1];
push (@x,$F[0]); push(@y,$F[1]);
END {
print join ("|", @x);
print join ("|", @y);
}' inputfile
A|B|C
1|2|3
$
$
Thanks all