The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
What the command to find out the record length of a fixed length file? tranq01 UNIX for Dummies Questions & Answers 9 12-04-2008 04:04 PM
find the length of file names in a directory? koti_rama Shell Programming and Scripting 5 06-04-2008 10:19 AM
help need to find the length of a variable smr_rashmy Shell Programming and Scripting 7 02-18-2008 06:02 AM
Find, make and move file based on username Helmi UNIX for Dummies Questions & Answers 5 04-19-2007 09:49 PM
find filename based on file content kollerj UNIX for Dummies Questions & Answers 4 06-02-2001 01:31 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-23-2007
J_ang J_ang is offline
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
  #2 (permalink)  
Old 03-23-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
find and size

man find
  #3 (permalink)  
Old 03-23-2007
J_ang J_ang is offline
Registered User
  
 

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

Join Date: Sep 2006
Posts: 2,509
one way
Code:
ls | awk '{ if (length($0) > 35)  print $0  " over 35 chars." }'
  #5 (permalink)  
Old 03-23-2007
J_ang J_ang is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 15
Thanks but want to search on directory/sub-directories
  #6 (permalink)  
Old 03-25-2007
ennstate ennstate is offline
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0