比较两列字符串,如果存在,则删除这两列记录

比较两列字符串,如果存在,则删除这两列记录
10/27/20 LGVD   LGVD-DLV1 ---(LGVD repated 6th line so do not disply it)
10/26/20 LPKK   LPKK-DLV1
10/28/20 LFLZ   LFLZ-DEV1  ---(LFLZ-DEV1 repeated 8th line so do not disply it)
11/02/20 LFLZ   LFLZ-TLST
11/01/20 LFZV   LFZV-DLV1
10/30/20 LFSM   LGVD          --(LGVD repated 1st line so do not disply it)
10/28/20 MDNO   MDNO-TLST
10/28/20 LFLZ-DEV1  LFIT-TLST -- (LFLZ-DEV1 repated 3rd  line so do not disply it)
10/28/20 LJID   LJID-TLST

期望输出

10/26/20 LPKK   LPKK-DLV1
11/02/20 LFLZ   LFLZ-TLST
11/01/20 LFZV   LFZV-DLV1
10/28/20 MDNO   MDNO-TLST
10/28/20 LJID   LJID-TLST

答案1

如果你不介意对文件进行两次检查,

$ awk 'NR==FNR{a[$2];b[$3];next} !($3 in a || $2 in b)' file file 
10/26/20 LPKK   LPKK-DLV1
11/02/20 LFLZ   LFLZ-TLST
11/01/20 LFZV   LFZV-DLV1
10/28/20 MDNO   MDNO-TLST
10/28/20 LJID   LJID-TLST

相关内容