Hi,
I have 2 input files-file 1 and file 2 with delimiter '|'.I need to extract 3rd column from file 1 and insert it after 3rd column in file 2.With my limited awk knowledge,this is what I have so far:
Code:
awk 'FS=OFS="|"{field[NR]=$3}; FS=OFS="|"{$3=($3 FS field[FNR]); print}' file1 file2
As of now, the $3 value in file2 is getting replaced. I don't want to lose the $3 value of file 2.Rather have the new value inserted after $3.Any help appreciated.Thanks!
Sample data:
File 1
Code:
1|2|3|4|5
6|7|8|9|10
File 2
Code:
a|b|c|d|e
f|g|h|i|j
Op required:
Code:
a|b|c|3|d|e
f|g|h|8|i|j