- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Only integers
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
Forums
Discussions
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
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
08-30-2001 08:13 AM
08-30-2001 08:13 AM
I need to check that a particular field in comma separated file has only integers.
I have tried it using typeset as
typeset -i txt
while read each;do
txt=`cut -f, -d1`
done
I have also used grep as
while read each;do
echo $each| cut -f, -d1 | grep -v [0-9] > /dev/null
if [ $? -eq 0 ]; then
non integer
fi
done < filename
This works but is very slow.
Can anyone help me write a faster script...
Thanks
...BPK...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2001 08:21 AM
08-30-2001 08:21 AM
Re: Only integers
Check this thread. We had a discussion on getting rid of this "typeset" problem.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x235f1012aa92d5118ff10090279cd0f9,00.html
Sridhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2001 08:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2001 08:24 AM
08-30-2001 08:24 AM
Re: Only integers
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2001 08:40 AM
08-30-2001 08:40 AM
Re: Only integers
Thanks JRF, it is faster than what I had tried.
And Sridhar Congratulations on becoming a 'GRADUATE' so fast.... keep it up....
Mana Desam peruni veluguloki techaru kadaa, meru...
...BPK...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2001 08:46 AM
08-30-2001 08:46 AM
Re: Only integers
As always, I'm glad to have helped, Praveen.
...and Sridhar, congratulations to you!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2001 09:46 AM
08-30-2001 09:46 AM
Re: Only integers
You are the inspiration for most of us.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2001 08:29 PM
09-12-2001 08:29 PM
Re: Only integers
if grep "[^0-9,]" fil1 > /dev/null
then
echo non integer
fi
Regards,
Suhas