#!/bin/ksh or bash or dash or ...
cat <<EOF > $0.txt
ASDF,QWER,GHJK,123,FGHY,9876
GHTY,NVHR,WOPI,623,HFBS,5386
GHTY,NVHR,WOPI,A623,HFBS,5386
EOF
num()
{
val="$1"
# replace numbers with nothing, rest chars are something else
otherchars="${val//[0-9]/}"
[ "$otherchars" != "" ] && return 1 # not num
return 0 # it's num
}
############################
oifs="$IFS"
cat $0.txt | while read line
do
IFS=","
flds=($line)
IFS="$oifs"
f4=${flds[3]}
f6=${flds[5]}
num "$f4" || echo "not num $f4"
num "$f6" || echo "not num $f6"
done
kurumi obviously didn't want to count empty columns as columns and therefore made sure there is anything in between. His regexp will match "a,b,c,..." but not "a,,,b,..." This is what the full stop is for.