awk ' BEGIN { FS = "\t" } NF > 0 && NF != 2 && NF != 3 { printf("%d: %d fields: %s\n", NR, NF, $0) next } $1 ~ /[][]/ || $2 ~ /[][]/ { printf("%d: includes brackets: %s\n", NR, $0) next } NF == 3 && $3 !~ /[][]/ { printf("%d: no brackets in $3: %s\n", NR, $0) next } ' "$@"