i used awk to sum up total size of files under a directory (with the help of examples, threads here).
ls -l | awk '/^-/ {total += $5} END {printf "%15.0f\n",total}' >> total.txt
After each execution of the script total result is appended into a text file:
7010
7794
8890
i would like to add the execution date of the script into first column and then the results to the second column, but i couldnt do it after some tries. Do you know how to modify the script to add the date (date format is not important)?
with "execution date of script" i meant the date when crontab run the script (monthly). Sorry for my bad explanation.. Let me try the scripts, thnx all
Thanks a lot it works well, the second script in your first post is great too. i will calculate the results with another awk that i wrote (i wish i could write such long lovely scripts like yours )