|
Search:
Advanced search
|
Browse by category:
|
Contact Us |
Quick One liners to test a string whether or not it is an Integer, Alphanumeric, or Character |
|||||
*note:
Solaris egrep flag = "-e" Linux egrep flag = "-E" To test a string whether or not it is numeric: ------------------------------------------------- # echo <string> |egrep -E '^[0-9]+$' # echo $? *note 1 = not numeric 0 = is numeric ------------------------------------------------- To test a string whether or not it is all lower case Characters: ------------------------------------------------- # echo <string> |egrep -E '^[a-z]+$' # echo $? *note 1 = not successful 0 = is successful ------------------------------------------------- To test a string whether or not it is all upper case A-Z characters ------------------------------------------------- # echo <string> |egrep -E '^[A-Z]+$' # echo $? *note 1 = not successful 0 = is successful ------------------------------------------------- To test a string whether or not it is all upper case and lower case A-Z characters ------------------------------------------------- # echo <string> |egrep -E '^[A-Za-z]+$' # echo $? *note 1 = not successful 0 = is successful ------------------------------------------------- To test a string whether or not it is all alphanumeric characters ------------------------------------------------- # echo <string> |egrep -E '^[0-9A-Za-z]+$' # echo $? *note 1 = not successful 0 = is successful ------------------------------------------------- |
|||||
Powered by
KBPublisher (Knowledge base software)