
01-07-2009
|
|
Shell programmer, author
|
|
|
Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
|
|
Quote:
Originally Posted by trichyselva
i have a input file like this
001|rahim|bajaj|20090102
while reading the file i need to check whether the first column is a number
second column is a name
is there any methodology to check for the same
|
Code:
while IFS='|' read a b c d
do
case $a in
*[![:digit:]]*) echo First column is not a number ;;
*) echo First column is a number ;;
esac
case $b in
*[![:alpha:]]*) echo Second column is not a name ;;
*) echo Second column is a name ;;
esac
done < "$FILE"
|