How to list files which have same size?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to list files which have same size?
# 1  
Old 11-22-2010
How to list files which have same size?

Hi guys,

I need to do 100 files comparison after I sorted the files. There are no specific key for sorting so i plan to arrange the files based on the file size. The command that i used to sort the files by size is as per below:-
Code:
ls -l | sort +4rn | awk '{print $5, $9}'

The problem that i face right now is, there are 2 files which have same size. So when i do comparison these 2 files are not match with each other. What I mean is, when i do the file comparison, the 000675 should compare with 000457 but it compare with 000470.

Example:-

dir A:-
Code:
1534     XXX_000675.20101122135836.XX
1534     XXX_000679.20101122135842.XX

dir B:-
Code:
1534    XXX_000457.20101122080310.XX
1534    XXX_000470.20101122080310.XX


So how i want to sort the file by file size which also have 2 files with the same size.
Do guys have idea on this?

Appreciate your respond

Last edited by Franklin52; 11-22-2010 at 05:15 AM.. Reason: Please use code tags
# 2  
Old 11-22-2010
Quote:
Originally Posted by shahril
Code:
ls -l | sort +4rn | awk '{print $5, $9}'

What does the highlighted syntax do? It's not valid on my system.
# 3  
Old 11-22-2010
It is ancient syntax: +position. +4rn means sort reverse numeric starting character pos 4.

I do not see what it actually does either, since the 4th position in the examples == 4.
# 4  
Old 11-22-2010
Might also be of interest :
Code:
man cksum
man bart
man digest

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List duplicate files based on Name and size

Hello, I have a huge directory (with millions of files) and need to find out duplicates based on BOTH file name and File size. I know fdupes but it calculates MD5 which is very time-consuming and especially it takes forever as I have millions of files. Can anyone please suggest a script or... (7 Replies)
Discussion started by: prvnrk
7 Replies

2. UNIX for Dummies Questions & Answers

Determining file size for a list of files with paths

Hello, I have a flat file with a list of files with the path to the file and I am attempting to calculate the filesize for each one; however xargs isn't playing nicely and I am sure there is probably a better way of doing this. What I envisioned is this: cat filename|xargs -i ls -l {} |awk... (4 Replies)
Discussion started by: joe8mofo
4 Replies

3. Shell Programming and Scripting

Compare list [ names and size files ]

Hello, I've downloaded a huge amont of files I've got a list of files from a remote server. -rw-r--r-- 1 str661 strem 453465260 Dec 16 15:54 SATRYS2V1_20021218_temp_bias.nc -rw-r--r-- 1 str661 strem 17669468 Dec 16 18:01 SATRYS2V1_20021225_hdyn_bias.nc -rw-r--r-- 1... (9 Replies)
Discussion started by: Aswex
9 Replies

4. UNIX for Dummies Questions & Answers

How to list all files in dir and sub-dir's recursively along with file size?

I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In have to list all the files in directory and its sub directories along with file path and size of the file Please help me in this regard and many thanks in advance. (3 Replies)
Discussion started by: nmakkena
3 Replies

5. UNIX for Dummies Questions & Answers

How to get size of a list of files with specified extension?

Command ls -l *cpp lists all cpp program files in a directory. It shows the size of each file. Using a calculator to work out the total size of the cpp files would be very tedious. Is there a way to get the total size from the command line? (5 Replies)
Discussion started by: resander
5 Replies

6. Solaris

calculate sum size of files by date (arg list too long)

Hi, I wanted a script to find sum of files for a particular date, below is my script ls -lrt *.req | nawk '$6 == "Aug"' | nawk '$7 == "1"'| awk '{sum = sum + $5} END {print sum}' However, i get the error below /usr/bin/ls: arg list too long How do i fix that. Many thanks before. (2 Replies)
Discussion started by: beginningDBA
2 Replies

7. Shell Programming and Scripting

list the files with size in bytes

hi all plz help in listing the files with size in bytes. thnks -Bali (4 Replies)
Discussion started by: balireddy_77
4 Replies

8. Shell Programming and Scripting

bash script working for small size files but not for big size files.

Hi, I have one file stat. Stat file contents are as follows: for example. H50768020040913,00260100,507680,13,0000000643,0000000643,00000,0000 H50769520040808,00260100,507695,13,0000000000,0000000000,00000,0000 H50770620040611,00260100,507706,13,0000000000,0000000000,00000,0000 Now i... (1 Reply)
Discussion started by: davidpreml
1 Replies

9. UNIX for Dummies Questions & Answers

Files list which are more than 300 MB size

Hi, I need to find files list which are more than 300 MB size? My script It should search all inner directories too. How can I proceed? Any idea? (2 Replies)
Discussion started by: redlotus72
2 Replies

10. UNIX for Advanced & Expert Users

Command to list Files less than or equal to 2k size

Hi, *.xml files stored on date wise folders. I need to extract *.xml files from all the folders. File size is lessthan or equal to 2K. Please let me know command or some shell program to due this job on linux m/c This is urgent, Thanks in advance - Bache Gowda (3 Replies)
Discussion started by: bache_gowda
3 Replies
Login or Register to Ask a Question