Help printing files in ascending order of the fi le size (in bytes)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help printing files in ascending order of the fi le size (in bytes)
# 1  
Old 09-27-2011
Help printing files in ascending order of the fi le size (in bytes)

Hey guys I'm new to unix and need help printing files in a specified directory according to size in bytes as well as files with equal bites in alphabetical order

the part i have done so far prints out all files in the directory as well as setting a time limit in which they have been modified

which looks like
Code:
find $1 -type f -mmin -$(($2*60))

one thing i have tried is
Code:
find $1 -type f -mmin -$(($2*60)) | ls -l |gawk '{print $5,$9|"sort -n"}'

but it seems to be switching the directory and I'm not sure why

anyways if anyone knows where i should start please reply, ty.

Moderator's Comments:
Mod Comment Video tutorial on how to use code tags in The UNIX and Linux Forums.

Last edited by Franklin52; 09-28-2011 at 04:33 AM.. Reason: Please use code tags, thank you
# 2  
Old 09-27-2011
You can use the -maxdepth 1 option on find to stop it switching into sub-directories.
# 3  
Old 09-28-2011
try this
Quote:
find . -type f -exec ls -l {} \; | sort -n +4
change the find command according to ur needs....
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to list files in ascending order?

Hi, I need to list files in ascending order. Filenames are in format inpTDT_1, inpTDT_2, inpTDT_3 and so on. I want to list them in the ascending order based on the digit after underscore and send the output to a file. Please help (5 Replies)
Discussion started by: Neelkanth
5 Replies

2. Shell Programming and Scripting

Unable to list files in ascending order

Hi ! I am just trying to list my files in ascending order so that in some other software, I just want merge with some modification, when I list its coming like this new-10.txt new-11.txt new-12.txt new-13.txt new-14.txt new-15.txt new-16.txt new-17.txt new-18.txt new-19.txt... (2 Replies)
Discussion started by: nex_asp
2 Replies

3. UNIX for Advanced & Expert Users

How to takes the missing files in ascending order

Hi am using unix aix we have a lots of files which comes from server and fetch in one directory. the files will be in the format as File name as : ------------- pprr0103 (01 as date and 03 as month) pprr0203 pprr0603 ... ... pprr3103 pprr0304 Outputs:- Missing files as... (2 Replies)
Discussion started by: Venkatesh1
2 Replies

4. Shell Programming and Scripting

Ascending order

How can I check if array is in ascending order? ---------- Post updated at 01:53 PM ---------- Previous update was at 01:25 PM ---------- Done it now (0 Replies)
Discussion started by: kristinu
0 Replies

5. Shell Programming and Scripting

How to list all the directories, sub directories in a mount along with size in ascending order?

Hi , I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In a particular mount, have to list all the directories and sub directories along with size of the directory and sub directory in ascending order. Please help me in this regard and many... (4 Replies)
Discussion started by: nmakkena
4 Replies

6. Shell Programming and Scripting

How to find size 0-4 bytes files?

Hi I need to find and delete 0-4 bytes size files in a folder. How can I achieve that? (1 Reply)
Discussion started by: kapilk
1 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. UNIX for Dummies Questions & Answers

SIZE OF FILES STORE IN WHICH FORMAT bytes or kb in unix?

Hi, i need to know regarding the size type of the files in unix environment.. whether a files or directory will store in which format? kb or bytes ? please answer to my question... thanks & regards, kamal (1 Reply)
Discussion started by: G.K.K
1 Replies

9. UNIX for Advanced & Expert Users

merge two files in ascending order

Hello Friends, I want to merge two files in ascending order on the first field. And if the first field matches sort on 3rd field i.e, TXADDR should come ahead of RXADDR . file1 9 : TXADDR : 00000000 65 : TXDATA 0000000000000011 83 : TXDATA 0000000000000012 453 :... (10 Replies)
Discussion started by: user_prady
10 Replies

10. UNIX for Advanced & Expert Users

Display modified files in ascending order

Hello, i want to display modified files in descending order. "ls -t" will display modified files in descending order. pls help. (1 Reply)
Discussion started by: balareddy
1 Replies
Login or Register to Ask a Question