I have two files:
f1file1.txt:
111|aaa|444
222|bbb|555
333|ccc|666
111|aaa|444
222|bbb|555
333|ccc|666
f2file2.txt:
111
(null)
333
111
(null)
333
replacing column 2two of f1file1 with column 1one of f2file2
required outputExpected Output
new:
111|111|444
222||555
333|333|666
111|111|444
222||555
333|333|666
iI am using thisthe below command awk 'BEGIN {FS=OFS="|"}NR == FNR {a[FNR] = $B;next}$A = a[FNR]' B=1 A=2 f2.txt f1.txt > new.txt,
awk 'BEGIN {FS=OFS="|"}NR == FNR {a[FNR] = $B;next}$A = a[FNR]' B=1 A=2 file2.txt file1.txt > new.txt
what iOutput which I am getting,
new:
111|111|444
333|333|666
111|111|444
333|333|666
I am loosing the second record. how to avoid loss of record.?