Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Match values in awk

$
0
0
Having trouble modifying the below awk to match $1 of sample.txt to $1 of data.txt and if there is a match, then $2 of data.txt is copied to $7 of sample.txt. Thank you :).

Code:

awk 'NR==FNR{A[$1]=$1; next}  A[$1]  {$1=$1 " " A[$6]}1' data.txt sample.txt > output.txt
Code:


Desired Output:
Data Type:        ImaGene                                       
Sample Name        File        Cnt Channel        Probe Type        Factor:Gender        Factor:Control Gender        Classfn
1        ./2523097xxxxx_1-31-2013/0_2523097xxxxx_Block1.txt        ./2523097xxxxx_1-31-2013/1_2523097xxxxx_Block1.txt        Agilent 016267        Female        Male        Likely_Benign=>chr5:175511777-175710070; Likely_Benign=>chr6:78842630-79075754; Benign=>chr8:39199768-39409984; Benign=>chr14:45789786-46003777
2        ./2523097xxxxx_1-31-2013/0_2523097xxxxx_Block2.txt        ./2523097xxxxx_1-31-2013/1_2523097xxxxx_Block2.txt        Agilent 016267        Female        Male        Likely_Benign=>chr3:93794-142515


Attached Files
File Type: txt data.txt (199 Bytes)
File Type: txt sample.txt (365 Bytes)

Viewing all articles
Browse latest Browse all 16232

Trending Articles