逐渐老去的IT菜鸟 Rotating Header Image

用awk剔除两个文件中的重复行

有a、b两个文件,需要删除b文件中的所有a文件行,例如
a文件:
111
222
abc

b文件:
111
ABc
def

最后显示:
def

使用awk如下即可:
awk ‘NR==FNR{a[tolower($0)]}NR!=FNR&&!(tolower($0) in a){print $0}’ a b

1 Comment

  • (Required)
  • (Required, will not be published)