Skip to main content
added 1 character in body
Source Link

I propose this alternative:

match="$(grep -vEvEx '[A-Z]{7}[[:space:]]+[A-Z]{3}' "$1")"
[[ "${#match}" -ne 0 ]] && printf "%b\n" "Bad lines:\n${match[@]}"
Bad lines:
FDFHDK JKL
1545665 152
867HDKE WER


Note from @they's answer:

The regular expression has been corrected to delete the extra + after {7}

I propose this alternative:

match="$(grep -vE '[A-Z]{7}[[:space:]]+[A-Z]{3}' "$1")"
[[ "${#match}" -ne 0 ]] && printf "%b\n" "Bad lines:\n${match[@]}"
Bad lines:
FDFHDK JKL
1545665 152
867HDKE WER


Note from @they's answer:

The regular expression has been corrected to delete the extra + after {7}

I propose this alternative:

match="$(grep -vEx '[A-Z]{7}[[:space:]]+[A-Z]{3}' "$1")"
[[ "${#match}" -ne 0 ]] && printf "%b\n" "Bad lines:\n${match[@]}"
Bad lines:
FDFHDK JKL
1545665 152
867HDKE WER


Note from @they's answer:

The regular expression has been corrected to delete the extra + after {7}

Source Link

I propose this alternative:

match="$(grep -vE '[A-Z]{7}[[:space:]]+[A-Z]{3}' "$1")"
[[ "${#match}" -ne 0 ]] && printf "%b\n" "Bad lines:\n${match[@]}"
Bad lines:
FDFHDK JKL
1545665 152
867HDKE WER


Note from @they's answer:

The regular expression has been corrected to delete the extra + after {7}