Replace column in one file with column from another using awk?
try: awk ‘FNR==NR{a[NR]=$3;next}{$2=a[FNR]}1’ f2 f1 Output: 111 000 444 222 111 555 333 555 666 Explanation of the above code: FNR==NR allows you to work with one entire file at a time. In this case it is the file f2. NR and FNR both contain line numbers with the difference being FNR gets reset to … Read more