awk -F "|" ' {found=0} {for(k=0;k<=NF;k++) if( $k == "xyz" ){ print "line="NR"(column="k")" found=1 } } !found{print "line="NR" (not found)"} ' myf