Hi ,
I am trying to write something to find the size of particular type of files in a directory & it's subdirectory and sum the size .. These types of file are found at directory level or its subdirectories level ..
#!/bin/ksh
FNAME='.pdf'
S_PATH=/abc/def/xyz
find $S_PATH -exec ls -lad {} \; > temp1
cat temp1 | grep -i $FNAME > temp2
awk 'NR>5{+$5}END{ print "Total " i}' temp2
Seems my awk is not working.. I am doing something stupid with awk.. Any simple way would be appreciated.
Input is
-rw-r--r-- 1 owner abcdef 1031 Sep 07 12:57 /abc/def/xyz/PAY_WFM/unique.pdf
-rw-r--r-- 1 owner abcdef 6279 Sep 07 12:57 /abc/def/xyz/SA1/unique.pdf
-rw-r--r-- 1 owner abcdef 987 Sep 07 11:59 /abc/def/xyz/T1/unique.pdf
-rw-r--r-- 1 owner abcdef 1650 Sep 07 12:57 /abc/def/xyz/A1/unique.pdf
-rw-r--r-- 1 owner abcdef 83477 Sep 07 12:57 /abc/def/xyz/DM/unique.pdf
-rw-r--r-- 1 owner abcdef 5845 Sep 07 12:57 /abc/def/xyz/TH/unique.pdf
-rw-r--r-- 1 owner abcdef 3266 Sep 07 12:57 /abc/def/xyz/MR/unique.pdf
-rw-r--r-- 1 owner abcdef 37295 Sep 07 12:57 /abc/def/xyz/PPO/unique.pdf
-rw-r--r-- 1 owner abcdef 242529 Sep 07 12:57 /abc/def/xyz/P/unique.pdf
-rw-r--r-- 1 owner abcdef 43072 Sep 07 12:57 /abc/def/xyz/P2/unique.pdf
-rw-r--r-- 1 owner abcdef 5485 Sep 07 12:57 /abc/def/xyz/P/unique.pdf
-rw-r--r-- 1 owner abcdef 4849 Sep 07 12:05 /abc/def/xyz/TP/skvunique.txt
-rw-r--r-- 1 owner abcdef 58730 Sep 07 12:57 /abc/def/xyz/M1/unique.pdf
Output wanted is --- > 494495 (which is sum of values in 5th column)
Thanks in advance.
Vaddadi