Print the total number of bytes used by a file called files:
ls -l files | awk '{ sum += $5 } END { print "total bytes: " , sum }'
Similar way for Kilo-bytes :
Print the total number of kilobytes used by a file called files:
ls -l files | awk '{ x += $5 } END { print "total K-bytes: " (x + 1023)/1024 }'
No comments:
Post a Comment