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

Match partial text

$
0
0
I posted the incorrect files yesterday and apologize. I also modified the awk script but with no luck. There are two text files in the zip (name.txt and output.txt). I am trying to match $2 in name.txt with $1 in output.txt and if they match then $1 of name.txt is copied to $7 of output.txt. The tricky part (well at least for me is), that only part of $2 will match $1. Thank you :).

Code:

awk 'NR==FNR{A[$1]=$2; next}  A[$2]  {$2=$2 " " A[$4]}1' output.txt name.txt > output.txt

HTML Code:

Desired output.txt
DTE3504500000001ref        34529        35031        1        DTE3504500000001        SeqRxn4  1
DTE3504500000001antiref        35031        34529        1


Attached Files
File Type: zip data.zip (728.0 KB)

Viewing all articles
Browse latest Browse all 16232

Trending Articles