Code:
a.txt
# header record
1,1,1,1,
2,3,4,5
3,4,5,6
b.txt
# header record
2,two,three,foor
Code:
awk -F"," 'FNR==NR{a[$1]=$2 FS $3","$4","$5","$6","$7","$8;next} $1 in a {print $0, a[$1]}' OFS='|' b.txt a.txt
Output using current code:
#|,,,,,,
2,3,4,5|two,three,foor,,,,
Desired Output:
2,3,4,5|two,three,foor,,,,