#! /bin/bash Policies="policy_fig8 policy_fig9 policy_fig10 policy_fig11 policy_fig12 policy_fig13 policy_fig14 policy_fig15 policy_fig16 policy_fig17" for policy in $Policies do gawk -v File=$policy 'BEGIN{FS=OFS=","}{seen[$1]+=1}END{for (x in seen){if (seen[x]>1){print File}}}' $policy done