I have a tab delimited column text like below
A 1 12 13
B 3 4 5
C 6 17 8
D 19 10 11
how could I convert the above table like below
A 1
A 12
A 13
B 3
B 4
B 5
C 6
C 17
.
.
.
With awk:
$ awk '{for (i=2;i<=NF;i++) print $1,$i}' file
A 1
A 12
A 13
B 3
B 4
B 5
C 6
C 17
C 8
D 19
D 10
D 11
To have the output tab delimited, you can use the OFS variable:
$ awk -v OFS='\t' '{for (i=2;i<=NF;i++) print $1,$i}' file
A 1
A 12
A 13
B 3
B 4
B 5
C 6
C 17
C 8
D 19
D 10
D 11
Bcolumn has value\t3. Why has it been missed from the result?