Extract a column from file 1 and insert in file 2
I want to extract the column9 from file1 and insert in between the columns 10 & 11 of file2.
How to do this using awk. Pls reply with syntax. Thanks and regards, Raje. |
What have you tried so far? You can pass both files to awk, do something when awk reads the first one (check the expression FNR == NR) and something else when awk reads the second one (check FNR < NR). Example:
Code:
awk 'FNR==NR{field[NR]=$9}; FNR<NR{$10=($10 FS field[FNR]); print}' file1 file2 |
Thank u so much. It worked.
Regards, Raje. |
All times are GMT -5. The time now is 01:00 AM. |