Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a shell script, which reports names and sizes of all files in a directory whose size is exceeding 1000 bytes

Posted By: Mason Evans     Category: Unix / Linux / Ubuntu     Views: 10451

Write a shell script, which reports names and sizes of all files in a directory (directory which is supplied as a argument to the shell script) whose size is exceeding 1000 bytes. The filenames should be printed in descending order of their sizes. The total number of such files should also be reported.

Code for Write a shell script, which reports names and sizes of all files in a directory whose size is exceeding 1000 bytes in Unix / Linux / Ubuntu

ls -l | cut -c 31-48,56- > b1
    tr -s ' ' < b1 >b2
    grep "^ [7-9][0-9][0-9]." b2 | sort -rn  

--------------------------------------------------------------------------------

output:
    $ SH24
     751 Nov ans52.sh      

  
Share: 



Mason Evans
Mason Evans author of Write a shell script, which reports names and sizes of all files in a directory whose size is exceeding 1000 bytes is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!