Compare two files based on the condition using awk

后端 未结 1 502
青春惊慌失措
青春惊慌失措 2021-01-29 01:52

I have two files:

1.txt:

j_e_s_s_i_c_a_a_n_n zoltan670605@freemail.hu  61b8a203438ea1c56c1489ec7bea7a0e
9871951 sexbollente@hotmail.com 671cb9239bf797a08         


        
相关标签:
1条回答
  • 2021-01-29 02:33

    Following awk may help you in same.

    awk '
    FNR==NR{
      val=$1;
      sub(/[^:]*/,"");
      sub(/:/,"");
      a[val]=$0;
      next
    }
    !($NF in a){
      print > "left.txt";
      next
    }
    {
      print $1,$2,a[$NF]> "result.txt"
    }
    '  FS=":" 2.txt FS=" "  OFS=" " 1.txt
    
    0 讨论(0)
提交回复
热议问题