Sort by segment size


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sort by segment size
# 1  
Old 08-23-2012
Sort by segment size

HTML Code:
fuser -OdV /temp
This command returns the output below;
HTML Code:
inode=132    size=10871        fd=2     5046330
inode=570    size=292          fd=1     5439528
inode=259    size=2669         fd=1     5570758
inode=759    size=255          fd=1     6226124
inode=636    size=1035         fd=1     6291594
inode=156    size=20480        fd=1     6422648
inode=634    size=1035         fd=1     6488204
inode=271    size=2669         fd=1     6684762
inode=777    size=64           fd=1     6815924
inode=623    size=42           fd=1     6946844
inode=454    size=546          fd=1     7143604
inode=157    size=87132        fd=1     7536892
inode=761    size=803          fd=1     7930064
inode=273    size=4096         fd=1     7995542
inode=550    size=19272991     fd=1     8716450
inode=322    size=6894879      fd=1     8781842
inode=325    size=3460         fd=1     8847558
inode=644    size=826          fd=1     8912936
inode=567    size=10804        fd=2     8978642
..............
Is there a way to sort by the size (i.e. size=10871)?

I want to display in desc order, so that

19272991 displays first then 6894879, etc...

Please advise.
# 2  
Old 08-23-2012
Code:
$ sort -n -t= -k 3,3 <file

inode=623    size=42           fd=1     6946844
inode=777    size=64           fd=1     6815924
inode=759    size=255          fd=1     6226124
inode=570    size=292          fd=1     5439528
inode=454    size=546          fd=1     7143604
inode=761    size=803          fd=1     7930064
inode=644    size=826          fd=1     8912936
inode=634    size=1035         fd=1     6488204
inode=636    size=1035         fd=1     6291594
inode=259    size=2669         fd=1     5570758
inode=271    size=2669         fd=1     6684762
inode=325    size=3460         fd=1     8847558
inode=273    size=4096         fd=1     7995542
inode=567    size=10804        fd=2     8978642
inode=132    size=10871        fd=2     5046330
inode=156    size=20480        fd=1     6422648
inode=157    size=87132        fd=1     7536892
inode=322    size=6894879      fd=1     8781842
inode=550    size=19272991     fd=1     8716450

$

Add -r if you want it reversed.
# 3  
Old 08-24-2012
PHP Code:

# fuser -OdV /tmp | sort -n -t= -k 3,3
 
inode=3502   size=193106       fd=1    
inode
=3502   size=193106       fd=2    
inode
=3513   size=139474       fd=2    
inode
=3511   size=261016       fd=1    
inode
=3502   size=193106       fd=2    
inode
=3502   size=193106       fd=2    
inode
=3502   size=193106       fd=2    
inode
=3502   size=193106       fd=2    
inode
=3512   size=103334       fd=2    
inode
=3510   size=274318       fd=2    
inode
=3502   size=193106       fd=2    
inode
=3513   size=139474       fd=1    
inode
=3513   size=139474       fd=2    
inode
=3510   size=274318       fd=1    
inode
=3510   size=274318       fd=2    
inode
=3510   size=274318       fd=
I tried this... Can we combine | sort ?
# 4  
Old 08-24-2012
Give us an example output of what you mean by "combine | sort"
# 5  
Old 08-24-2012
I meant
PHP Code:
fuser -OdV /tmp sort --t= -k 3,
rather do
PHP Code:
<file 
Please advise.
# 6  
Old 08-25-2012
What is this '<file' you wish to read from?

The sort worked on my system, what's yours?
# 7  
Old 08-27-2012
Quote:
Originally Posted by Corona688
What is this '<file' you wish to read from?

The sort worked on my system, what's yours?
HTML Code:
fuser -OdV /tmp
will display the output already, so we don't need
HTML Code:
<file
at all.

Please advise.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Sort by file/directory size

OS : RHEL 6.6 I want to list the files/directories sorted (Ascending or Desceding) by their size. As you can see in the below example, du command doesn't sort by size. In Linux world, is there any other command or workaround using du command to list the files/directories sorted by their... (6 Replies)
Discussion started by: John K
6 Replies

2. UNIX for Dummies Questions & Answers

[Solved] Size (Sort files using ...)

-rw-r--r-- 1 oracle oinstall 4 Jan 17 16:23 a -rw-r--r-- 1 oracle oinstall 212 Jan 17 17:51 amar -rw-r--r-- 1 oracle oinstall 32 Jan 17 17:30 b -rw-r--r-- 1 oracle oinstall 246 Jan 17 15:40 h1.tar.gz Hi, I want combination of linux command to sort out the line which has 32k size. ... (5 Replies)
Discussion started by: karthick nath
5 Replies

3. Shell Programming and Scripting

Script to sort by size of directories

Hello, I'm trying to find top 5(highest) directories by size. I did something like du -sh * > $file Where I can get all the size with respect to directories, but I need only top 5 directory from the file. How can I sort by size in the file and print top 5 sizes with the directory name??? ... (3 Replies)
Discussion started by: pjeedu2247
3 Replies

4. Shell Programming and Scripting

Sort by name, time, and size

How do you combine these ls commands so that I can have the outputs by name, time stamp, and size? ls -al |grep name_of_file ls -al | sort +4nr ls -l -t Please advise. (4 Replies)
Discussion started by: Daniel Gate
4 Replies

5. Programming

Data segment or Text segment

Hi, Whether the following piece of code is placed in the read-only memory of code (text) segment or data segment? char *a = "Hello"; I am getting two different answers while searching in google :( that's why the confusion is (7 Replies)
Discussion started by: royalibrahim
7 Replies

6. Shell Programming and Scripting

sort by size

Can some one help in sorting the attached file. I used cmd: sort -r jar1.txt -o sortedjar.txt , but it didnt work. Thanks for your help in Advance. (6 Replies)
Discussion started by: sawyer
6 Replies

7. Shell Programming and Scripting

Can't sort file by size column

Hello, I've done ls -ls >fileout1 When I do the sort command for +4 it sorts it bu group. When I do +5 it sorts it by date. But it's skipping the file size column. Example: rwxr-xr-x 1 Grueben sup 65 16 Sep 13:58 cdee How can I sort it by file size? It doesn't... (2 Replies)
Discussion started by: Grueben
2 Replies

8. UNIX for Dummies Questions & Answers

Sort fdupes output by size

Hi I have a file that is a fdupes output. I'd like to sort the duplicated file by size. The format file is the following: 5996544 bytes each: /path1/to/file1.jpg /path2/to/file1.jpg /pathx/to/file1.jpg ... random number of lines /path999/to/file1.jpg 591910 bytes each:... (2 Replies)
Discussion started by: AdminLew
2 Replies

9. UNIX for Dummies Questions & Answers

sort by size in Mb and Kb

Hi I am using the command below to list the 10 biggest directories and files in my present directory du -hs * | sort +0 | tail -10 the output is 8K disk-space 16K rish 32K WINDOWS 48K tests 104K imgvdEwLa.jpg 168K 020204_aerosmith_1024768.jdk 3.2M Acdc -... (4 Replies)
Discussion started by: the.noob
4 Replies

10. UNIX for Dummies Questions & Answers

sort files by size

Is there a way to sort files by size using the ls command? thanks in advance (1 Reply)
Discussion started by: AMD
1 Replies
Login or Register to Ask a Question