awk: two files are queried

前端 未结 1 890
谎友^
谎友^ 2021-01-28 06:24

I have two files

file1:

>string1Name1
>string2Name2
>string3Name3

file2

相关标签:
1条回答
  • 2021-01-28 07:01

    your assignment is not right.

    $ awk 'BEGIN   {FS=OFS="\t"}
           NR==FNR {a[$1]=$2; next} 
           $1 in a {print a[$1],$2}' file1 file2
    
    Name1 sequence1
    Name2 sequence2
    
    0 讨论(0)
提交回复
热议问题