Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Test field for numeric or alphanumeric

Status
Not open for further replies.

shieh

MIS
Sep 17, 2002
30
US
Is there a way to test an input field cotains either numeric or alphanumeric in ksh script?
Thanks in advance.
 
man expr

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
In the ksh man page take a look at typeset

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks,
Can you elaborate more on how to use expr to check a field for numeric or alphanumeric?
 
In the ksh man page you may also take a look at case

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
To best of my knowledge, typeset uses for defining a field type. My question was if I have a predefined alphanumeric filed as input. How can test it to see there is no numeric character in the filed.
Thanks
 
case ${your predefined var} in *[0-9]*) echo bad; esac

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top