Search Results

Search: Posts Made By: Prabal Ghura
1,308
Posted By Don Cragun
Then change the field separator value before...
Then change the field separator value before reading each file:
awk 'FNR==NR{A[$1]=$2;next} $1 in A{$2=A[$1]} 1' FS='x' Input_file2 FS='y' OFS='y' Input_file1
where x is the field separator in...
1,308
Posted By RavinderSingh13
Hello Prabal Ghura, So let's say your 1 file...
Hello Prabal Ghura,

So let's say your 1 file named Input_file2 has delimiter as ; and Input_file1 has delimiter as ,, we could set it for both of them. This is just an example, you could try to...
1,308
Posted By RudiC
Howsoever, try also awk 'FNR == NR {T[$1] = $2;...
Howsoever, try also
awk 'FNR == NR {T[$1] = $2; next} $1 in T {$2 = T[$1]} 1' FS=";" OFS=";" file2 file1
1,308
Posted By RavinderSingh13
Hello Prabal Ghura, Could you please try...
Hello Prabal Ghura,

Could you please try following.

awk -F";" FNR==NR'{A[$1]=$0;next} ($1 in A){print A[$1] FS $NF;next} {print}' Input_file2 Input_file1
Output will be as follows.
...
Showing results 1 to 4 of 4

 
All times are GMT -4. The time now is 10:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy