Open HenrikBengtsson opened 6 years ago
On tedious proposal in Bash:
## Validate tab-delimited CONV file
ntabs=($(grep -vE "^[ ]*#" "${CONV}" | while IFS=$'\t' read -r -a dummy; do echo "${#dummy[@]}"; done | sort -u))
if [[ ${#ntabs[@]} != 1 ]]; then
echo "ERROR: Tab-delimited file '${CONV}' has different number of TABs on different lines: ${ntabs[*]} (should only be a single unique value)"
exit 1
elif [[ ${ntabs[0]} != 4 ]]; then
echo "ERROR: Tab-delimited file '${CONV}' should have exactly 4 TABs on each lines: ${ntabs[*]}"
exit 1
fi
From https://github.com/UCSF-Costello-Lab/LG3_Pipeline/issues/98#issuecomment-433174059;