Command Line Scripts

For Calculate 5th column of ls -l output:

root@vidyavathi # ls -l
total 2
-rw-r--r-- 1 root root 0 Sep 22 17:40 datadg01
drwxr-xr-x 2 root root 96 Sep 22 16:49 lost+found
-rw-r--r-- 1 root root 38 Sep 22 16:53 nila
root@vidyavathi # ls -l | ls -l | awk 'BEGIN{SUM=0} {SUM=SUM+$5} END{print "Column 5 Total =" SUM}'
Column 5 Total =134
root@vidyavathi #

No comments: