- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - HP-UX
 - >
 - Re: file name
 
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
 
06-04-2004 02:06 AM
06-04-2004 02:06 AM
How to test the numbers of
caracters in a file name ?
example: fic_1.log
9 caracters for this file.
thanks a lot.
Solved! Go to Solution.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-04-2004 02:10 AM
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-04-2004 02:11 AM
06-04-2004 02:11 AM
			
				
					
						
							Re: file name
						
					
					
				
			
		
	
			
	
	
	
	
	
print "${fileName} has ${#fileName} characters."
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-04-2004 02:22 AM
06-04-2004 02:22 AM
			
				
					
						
							Re: file name
						
					
					
				
			
		
	
			
	
	
	
	
	
For example:
wc /etc/hosts
18 94 567 /etc/hosts
or wc -c /etc/hosts
567 /etc/hosts
Rgds...Geoff
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-04-2004 02:22 AM
06-04-2004 02:22 AM
			
				
					
						
							Re: file name
						
					
					
				
			
		
	
			
	
	
	
	
	
Anil
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
06-04-2004 02:27 AM
06-04-2004 02:27 AM
			
				
					
						
							Re: file name
						
					
					
				
			
		
	
			
	
	
	
	
	
Tou should use either ${#filename} or use awk as below to get the actual no. of characters.
echo $fname | awk {'print length'}
# fname=fic_1.log
# echo $fname | wc -c
10
# echo $fname | awk {'print length'}
9
# print ${#fname}
9