I am doing a homework which ask me to find the smallest file and biggest file under the directory, I have done that. But my output is something like "the smallest file is xxx (xxxx -'filename' bytes) I wish I could print something without the filename part. I am using du -b $filename to get the size.
            Asked
            
        
        
            Active
            
        
            Viewed 821 times
        
    1
            
            
        - 
                    Can we see some output of what you get and what you want? – squiguy Nov 27 '12 at 21:39
- 
                    http://stackoverflow.com/questions/428109/extract-substring-in-bash – Kirill Kulakov Nov 27 '12 at 21:39
1 Answers
0
            
            
        du -b | sort -rh | head -n 1 | awk '{print "The smallest file is " $1 " bytes"}'
 
    
    
        Rawkode
        
- 21,990
- 5
- 38
- 45
