Showing only files with a certain length


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Showing only files with a certain length
# 1  
Old 09-23-2010
Showing only files with a certain length

so I need to list all the files in a folder with x character, where x is an arbitrary number. I am not sure of the whole command, but I think it's something like the following:

ls grep -l

What am I missing? What should the command be if I am wrong?

Any help would be appreciated.
# 2  
Old 09-24-2010
can you show an example of input and expected output?
# 3  
Old 09-24-2010
well, the incomplete input is: ls grep -l, at the /bin/ folder
and the expected output is a list of all the files inside the bin folders with exactly fifteen characters.
Does that help in getting an answer?
# 4  
Old 09-24-2010
Code:
ls -l | nawk '$5 == 15'

grep could give false positives.
# 5  
Old 09-24-2010
Code:
ls -d ???????????????

# 6  
Old 09-24-2010
The problem is not explained very well.

Maybe you want a list of all files in directory /bin which have a size of exactly 15 characters:

Code:
find /bin type f -size 15c -exec ls -ald {} \;


The posts from scrutinizer and quirkasaurus are equally valid interpretations of you requirement.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep showing all files name of the directory

Hi All, Can any one help me here.I'm getting whole files name of the directory along with the grep result. below is the code var=`grep -i '127.3.3.1' _record` echo $var (9 Replies)
Discussion started by: netdbaind
9 Replies

2. Red Hat

Disk usage showing 100% after deleting files also | Red Hat Linux 3.2.2-5

My Redhat Linux system is always showing 100& disk usage. I have removed almost all the files, but no use and I am always getting 100% disk usage.!! Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda2 36337384 36066352 0 100% / I can... (7 Replies)
Discussion started by: sanoop
7 Replies

3. Shell Programming and Scripting

Showing files that were created at a certain Date

Guys i am having a bit of a trouble finding the creation date of a file. What i have to do is to redirect the output of a command (which i believed was ls -l but this command shows only the Modification time) into a file, which will contain all the files that were created on a certain date, for... (2 Replies)
Discussion started by: jimas13
2 Replies

4. UNIX for Dummies Questions & Answers

List the files whole length is < 5 in a directory

Can some one pls help me Unix command to List the files whole length is < 5 in a directory (4 Replies)
Discussion started by: asappidi
4 Replies

5. Solaris

prn----xc zero length files

Solaris 10 running Webserver 7 I keep getting MANY prn----xc zero length files created in /var/tmp owned by the process that runs the web server (webservd). I can not figure out what process is creating them. The dashes appear to be random numbers as in prn1921xc. I thought they might be... (3 Replies)
Discussion started by: frank-7130
3 Replies

6. UNIX for Dummies Questions & Answers

Showing Moved Files

Hi everyone, In a directory I have files with various extensions. I would like to move all the files ending in .L2 into a directory: ~/test. But I would also like to show which files are being moved. Of course I could type: $ ls *.L2 $ mv *.L2 ~/test Is there a way I can combine these two... (5 Replies)
Discussion started by: msb65
5 Replies

7. UNIX for Dummies Questions & Answers

Sort files by date, not showing files from today

Hi all, i'm new here in this forum. I really like the helpful answers in this forum. Here a short question. For a script i have to sort files by date and exclude the files of the actual date. Sorting the files by date and preparing the output for awk is done by this line: ls -l... (3 Replies)
Discussion started by: carlosdivega
3 Replies

8. Shell Programming and Scripting

Awk with fixed length files

Hi Unix Champs, I want to awk on a fixed length file. Instead if the file was a delimited file, then I could have used -F and then could have easily done manipulation on the fields. How do i do the same in case of fixed length file? Thanks in Advance. Regards. (7 Replies)
Discussion started by: c2b2
7 Replies

9. Shell Programming and Scripting

sort on fixed length files

Hi How to sort a fixed length file on a given char range and just display the duplicates. I did search for man sort to find any option but could find any.,something similar to cut -c 1-5,25-35. I have alternate way of doing this by using combination of cut,awk. but this creates extra temp... (6 Replies)
Discussion started by: sach_in
6 Replies

10. UNIX for Advanced & Expert Users

Tab Completion showing files that Dont Exist

Has anyone seen this before? if i ls a particular directory (an email Maildir) i get a long list of files, if i 'du -h' that same directory, i get messages like: du: `./1053894791.17207_0.srweb,S=6199': No such file or directory strange. so using tab will complete this filename too, giving... (3 Replies)
Discussion started by: dittonamed
3 Replies
Login or Register to Ask a Question