![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Check file size and remove files | srivsn | Shell Programming and Scripting | 5 | 05-28-2009 02:09 PM |
| Cp files (>5 Mb size) from one directory to another | skcontact | UNIX for Dummies Questions & Answers | 6 | 06-12-2008 08:39 AM |
| listing files in a directory in bases of size | arunkumar_mca | UNIX for Dummies Questions & Answers | 1 | 02-13-2008 07:38 AM |
| Find files size 0 within a directory | astonmartin | Shell Programming and Scripting | 3 | 02-07-2008 04:49 PM |
| How to check directory size | umen | UNIX for Dummies Questions & Answers | 4 | 08-30-2005 09:02 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to check if 3 files have same size in directory
I need to determine if any three files have the same file size in a specified directly?
I have got as far as listing the file sizes but where to go from here? ls -al |sort -n -r +4 | awq '{print $5}' Thanks in anticipation |
|
||||
|
How to check if any three files are the same size in a directory
If I am not mistaken this assumes you know the names of the three file to compare.
What I need is a script that assumes you do not know the names "x1" "x2" "x3" at the start. Say you have a directory of 1000 files - the question is do any three (or more) of these 1000 files have the same size. or another way to satisfy my needs would be a script: Do the last three files created have the same size? Thanks. |
|
||||
|
My solution - last three created files same size?
Thanks for this - final line is:
ls -l | tail -3 | awk 'BEGIN {sum=0 ; value=0} { sum+=$5 ; value=$5 } END { if ( sum/3 == value ) { print "equal" ; } else {print "not equal" } }' on the assumption ls -l returns the files in created time sequence by default |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|