- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Testing for numbers
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2004 05:01 PM
12-12-2004 05:01 PM
Testing for numbers
....
....
DIFFLOTID, 1234
....
....
where 1234 is the lotid.
I would like to ask, how can i test it if the lotid contains other character other than numbers.
Maximum points to all correct replies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2004 05:43 PM
12-12-2004 05:43 PM
Re: Testing for numbers
print $0" OK lotid"
else
print $0" bad lotid"
' fileWithLotids
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2004 07:15 PM
12-13-2004 07:15 PM
Re: Testing for numbers
another possibility is to read the field and delete all numeric charecters from it to check if something still remains - as in the attached script, which can be run like this:
# attached.sh
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2004 07:42 PM
12-13-2004 07:42 PM
Re: Testing for numbers
Another solution is to assign the value to a integer variable (typeset -i
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2004 07:57 PM
12-13-2004 07:57 PM
Re: Testing for numbers
Thanks for the replies. My querries are, test 1234 as numeric or alphanumeric. The field DIFFLOTID either contains 1234 or 1234ver value. The reason i would like to test the value is because most value should contain numerics only but somehow i saw some value with alphanumerics e.g., 1234a, cor_1234 etc..
I currently get the value of DIFFLOTID using the command below:
Var=$(awk -F "," '/DIFFLOTID/ {print $2}' $FILE)
The $Var now contains the value and i need to test it if $Var is numeric or alphanumeric.
If the $Var is alphanumeric, i need to move it to a temporary directory.
Many thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2004 08:26 PM
12-13-2004 08:26 PM
Re: Testing for numbers
var1=1
((var2=var/var1))
if [ $? -ne 0 ]
then
echo " It's a Alphanumeric Character"
else
echo "it's a numeric character "
fi
Hope that works.
Regards,