HPE GreenLake Administration
- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - HP-UX
 - >
 - user input
 
Operating System - HP-UX
        1840155
        Members
    
    
        2594
        Online
    
    
        110162
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              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
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            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
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
Topic Options
			
				
					
	
			
		
	- 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-11-2001 01:41 PM
12-11-2001 01:41 PM
			
				
					
						
							user input
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Hi Folks,
What is the best to find out the given value/format is O.K. User will input the parameter mins=10,20,30 or mins=10-20 or mins=10 (all of them are acceptable.) and I need to findout that user has not entered garbage. I wrote a program using awk, so I need this check in awk program. Thanks in adv.
Kris
		
		
	
	
	
What is the best to find out the given value/format is O.K. User will input the parameter mins=10,20,30 or mins=10-20 or mins=10 (all of them are acceptable.) and I need to findout that user has not entered garbage. I wrote a program using awk, so I need this check in awk program. Thanks in adv.
Kris
		1 REPLY 1
	
	            
            
		
		
			
            
                - Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
12-11-2001 03:33 PM
12-11-2001 03:33 PM
			
				
					
						
							Re: user input
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Here is a sample piece of code. By using arrays in awk, you can parse and test the data.
mins="10,20,30"
ok=1
split(mins,ary,",")
for (xx in ary) {
split(ary[xx],c,"-")
for (yy in c) {
if (! match(c[yy],"^[0-9]+$")) { ok=0 }
}
}
print ok
The variable "ok" will be 0 if mins is not ok and 1 if mins is ok.
PS: Perl could do this a lot easier...
-- Rod Hills
					
				
			
			
				
		
		
	
	
	
mins="10,20,30"
ok=1
split(mins,ary,",")
for (xx in ary) {
split(ary[xx],c,"-")
for (yy in c) {
if (! match(c[yy],"^[0-9]+$")) { ok=0 }
}
}
print ok
The variable "ok" will be 0 if mins is not ok and 1 if mins is ok.
PS: Perl could do this a lot easier...
-- Rod Hills
	There be dragons...
			
			
				
			
			
			
			
			
			
		The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP