The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find the length of file names in a directory? koti_rama Shell Programming and Scripting 5 06-04-2008 07:19 AM
help need to find the length of a variable smr_rashmy Shell Programming and Scripting 7 02-18-2008 02:02 AM
What the command to find out the record length of a fixed length file? tranq01 UNIX for Dummies Questions & Answers 3 10-19-2007 11:16 AM
Find, make and move file based on username Helmi UNIX for Dummies Questions & Answers 5 04-19-2007 06:49 PM
find filename based on file content kollerj UNIX for Dummies Questions & Answers 4 06-02-2001 10:31 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-23-2007
Registered User
 

Join Date: Jun 2006
Posts: 15
Need find a file based length

Can some please help me? Want to find files over 35 characters in length? I am running HPUX. Would it be possible with find?

Thanks in advance
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-23-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,448
find and size

man find
Reply With Quote
  #3 (permalink)  
Old 03-23-2007
Registered User
 

Join Date: Jun 2006
Posts: 15
Not the file size… Want to retrieve based on file's name length
Reply With Quote
  #4 (permalink)  
Old 03-23-2007
Registered User
 

Join Date: Sep 2006
Posts: 1,423
one way
Code:
ls | awk '{ if (length($0) > 35)  print $0  " over 35 chars." }'
Reply With Quote
  #5 (permalink)  
Old 03-23-2007
Registered User
 

Join Date: Jun 2006
Posts: 15
Thanks but want to search on directory/sub-directories
Reply With Quote
  #6 (permalink)  
Old 03-25-2007
Registered User
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Using find

Hi,
I think the following script should solve the problem.

Code:
#!/bin/ksh
for v in $(find . -name '*' -type f  -print ) ; do
 f=${v##*/}
 if [[ ${#f} -gt 35 ]] ; then
   print " $v is the name of file with more than 35 char"
 fi
done
Please let us know if this doesn't works out.

Thanks
Nagarajan Ganesan.
Reply With Quote
  #7 (permalink)  
Old 03-25-2007
Am not alone now!!!!
 

Join Date: Feb 2007
Location: Cochin, India
Posts: 242
Give a try on this.....

ls -R | awk -F" " '/^[a-zA-Z0-9]/ {if (length($0)>35) {print $0}}'

Thnx.
Dennis
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0