Не могли бы вы попробовать следующее.
awk -F"[ |]" '
FNR==1{
print $1,"1_B",$2,"2_B",$3,"3_B"
next
}
FNR>1{
for(i=1;i<=NF;i++){
$i=$i "|" $i
}
}
1
' Input_file
Объяснение: Добавление пояснения к вышеуказанному коду.
awk -F"[ |]" ' ##Setting field separator eiter space or pipe here.
FNR==1{ ##Checking condition if this is first line.
print $1,"1_B",$2,"2_B",$3,"3_B" ##Printing headers as per OP.
next ##Using next will skip all further statements from here.
} ##Closing FNR==1 condition BLOCK here.
FNR>1{ ##Checking condition if FNR>1 then do following.
for(i=1;i<=NF;i++){ ##Starting a for loop from i=1 to till value of NF(number of fields in current line).
$i=$i "|" $i ##Setting value of current field to current field |(pipe) current field value here.
} ##Closing BLOCK for for loop here.
} ##Closing BLOCK for FNR>1 condition here.
1 ##Mentioning 1 will print edited/non-edited current line here.
' Input_file ##Mentioning Input_file(which we need to process here).
Вывод будетследующим образом.
1_A 1_B 2_A 2_B 3_A 3_B
1|1 0|0 0|0 0|0 0|0 0|0
0|0 0|0 0|0 0|0 1|1 1|1
1|1 1|1 1|1 0|0 1|1 0|0
0|0 1|1 1|1 1|1 0|0 0|0
0|0 1|1 1|1 0|0 0|0 0|0
0|0 0|0 0|0 0|0 0|0 0|0
0|0 1|1 1|1 1|1 0|0 1|1
0|0 0|0 0|0 0|0 1|1 0|0
1|1 1|1 1|1 0|0 0|0 1|1
0|0 0|0 0|0 0|0 0|0 0|0