•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,439 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,625 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 629 | Replies: 0
![]() |
•
•
Join Date: Aug 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hello.
I've given a task to 'print all the files in a directory in the format---<File name> <Size in Byte> <No of Disk blocks used> ,sorted by 'disk blocks used'(reverse order)..............if same no of disk blocks are used by two files then largest file will be printed first'
I used the stat command like this-
stat * -c "%n %s %b" | sort -n -r -k 2,3
but if there is a whitespace in the filename then the sorting becomes all messed up, .......if there is any way to interchange columns or anything else.
thanks for any help
I've given a task to 'print all the files in a directory in the format---<File name> <Size in Byte> <No of Disk blocks used> ,sorted by 'disk blocks used'(reverse order)..............if same no of disk blocks are used by two files then largest file will be printed first'
I used the stat command like this-
stat * -c "%n %s %b" | sort -n -r -k 2,3
but if there is a whitespace in the filename then the sorting becomes all messed up, .......if there is any way to interchange columns or anything else.
thanks for any help
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Need Help for identify the Sorting Action (VB.NET)
- sorting stl::map (C++)
- counting comparisons when sorting (C++)
- sorting an array of string (C)
- help by sorting a simply linked list (C)
- sorting file (C)
- sorting 2d arrays (C)
- re: Sorting Algorithms (C++)
Other Threads in the Shell Scripting Forum
- Previous Thread: Logging into a page automatically using shell script.
- Next Thread: Comparing two files...


Linear Mode