Need find a file based length


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need find a file based length
# 1  
Old 03-23-2007
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  
Old 03-23-2007
find and size

man find
# 3  
Old 03-23-2007
Not the file size... Want to retrieve based on file's name length
# 4  
Old 03-23-2007
one way
Code:
ls | awk '{ if (length($0) > 35)  print $0  " over 35 chars." }'

# 5  
Old 03-23-2007
Thanks but want to search on directory/sub-directories
# 6  
Old 03-25-2007
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.
# 7  
Old 03-26-2007
Give a try on this.....

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

Thnx.
Dennis
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Splitting the file based on two fields - Fixed length file

Hi , I am having a scenario where I need to split the file based on two field values. The file is a fixed length file. ex: AA0998703000000000000190510095350019500010005101980301 K 0998703000000000000190510095351019500020005101480 ... (4 Replies)
Discussion started by: saj
4 Replies

2. Shell Programming and Scripting

Delimit file based on character length using awk

Hi, I need help with one problem, I came across recently. I have one input file which I need to delimit based on character length. $ cat Input.txt 12345sda231453 asd760kjol62569 sdasw4g76gdf57 And, There is one comma separated file which mentions "start of the field" and "length... (6 Replies)
Discussion started by: Prathmesh
6 Replies

3. Shell Programming and Scripting

How to find the length of MP4 file in cygwin?

Hi, Apologies if I'm posting in wrong section. How can I find length (duration) of MP4 videos and m4a audio files on cygwin? I heard about mediainfo, ffmpeg, avconv utilities on Linux platform but not sure if they work (or available) on cygwin. Please advise, TIA (1 Reply)
Discussion started by: prvnrk
1 Replies

4. Shell Programming and Scripting

Flat file-make field length equal to header length

Hello Everyone, I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table. Input Data- ------ ------------------------ ---- ----------------- WFI001 Xxxxxx Control Work Item A Number of Records ------ ------------------------... (5 Replies)
Discussion started by: sonali.s.more
5 Replies

5. Shell Programming and Scripting

Find the length of each line in the file

Hi, I want to find the length of each line(including all the characters, spaces etc.) in a file and check if all the lines are of same length using a ksh script. Please help. Thanks in advance. (7 Replies)
Discussion started by: Suryaaravindh
7 Replies

6. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

7. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

8. Shell Programming and Scripting

How To Find Length of a Field in XML File

Hi I have a xml file with below data...have to find the length of the filedvalues... <?xml version="1.0" encoding="ISO-8859-15" standalone="no"?><abc xmlns:xsi="http://www.w3.org/2000/XMLSchem... (3 Replies)
Discussion started by: naughty21
3 Replies

9. Shell Programming and Scripting

find the length of file names in a directory?

Hi, how can find length of file names in a directory. Examp: I have a directory with name "d1". directory: d1 files: aaa.log bbb.log abcd.log abcdef.log I wold like out put like: file name legnth aaa.log 3 bbb.log 3 abcd.log 4 abcdef.log 5 (5 Replies)
Discussion started by: koti_rama
5 Replies
Login or Register to Ask a Question